Using Accord.Imaging in UWP - imaging

(apologies for beginner question) I am trying to use Accord.Net Imaging function in an UWP windows 10 App. Any function I try gives me an error:
The type 'Bitmap' is defined in an assembly that is not referenced. You must add a reference to assembly 'CoreCompat.System.Drawing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.The type 'Bitmap' is defined in an assembly that is not referenced. You must add a reference to assembly 'CoreCompat.System.Drawing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
although I included Using System.Drawing (which includes Bitmap)
UnmanagedImage unmanagedImage = UnmanagedImage.FromByteArray(bytes);

If you're using NuGet, you can install the following package to get System.Drawing, and thus access to the Bitmap class: https://www.nuget.org/packages/CoreCompat.System.Drawing.v2/5.2.0-preview1-r131
Note that this is a prerelease version, so you'll need to check the box that says "Include prerelease" next to the search bar if using the Visual Studio NuGet GUI.

Related

Firebase Database in Unity with REST API

I am trying to create a connection to the Firebase Realtime Database by following this tutorial: https://medium.com/#rotolonico/firebase-database-in-unity-with-rest-api-42f2cf6a2bbf to understand how it works and modify as I go. However, I am getting the following errors (these are just some of the errors):
Assembly DLL name is reserved for internal use: Assets/UnityEngine.dll (did files generated by a build accidentally end up in your Assets/ folder?)
C:\Program files\2019.4.20f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\FontData.cs(135,16): error CS0433: The type 'TextAnchor' exists in both 'UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'`
C:\Program Files\2019.4.20f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\InputField.cs(241,10): error CS0433: The type 'SerializeField' exists in both 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
These errors are populating when I did the following steps:
Navigate to the Build Files (DLL) folder.
Open CommonData.csproj in your favorite text editor.
Change the UnityInstallFolder value on line 6 to point to your Unity installation directory
On OSX this is likely /Applications/Unity/Editor
On Windows this is likely C:\Program Files (x86)\Unity\Editor
Double click FullSerializer.sln to open up the solution
Run a build-all (F6 in visual studio). Alternatively, you can right-click any of the three projects to build only one of them.
FullSerializer - NoUnity builds Full Serializer so that you can use it outside of Unity.
FullSerializer - Unity builds Full Serializer to a DLL
FullSerializer - Unity - WinRT builds Full Serializer with WinRT APIs (if you're targeting the Windows Store or the Windows Phone export platforms)
You will find the DLLs inside of the Build folder. Please add them to your Unity project's Asset folder.
Here is the path where unity is installed:
C:\Program Files\2019.4.20f1\Editor
I opened the FullSerializer.sln, and build one of the three projects, and so on.
I am not sure what I am doing wrong. Any help would be appreciated.
I was able to determine the issue. It appears that although the instruction suggests adding the source folder in the assets folder of the Unity Project, I remove it from there and put it in the same level as the assets folder. That resolved the issue. Hope this helps anyone else who has encountered this issue.

Can't load Entity Framework Core in Azure Function

I'm trying to use Entity Framework Core with a C# Azure Function, and I'm getting tons of errors with libraries. Starting from the default HTTP trigger template, I created a project.json file containing
{
"frameworks": {
"net46":{
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0"
}
}
}
}
When the package restore finishes, the compiler can no longer find the extension methods in HttpRequestMessageExtensions:
016-12-21T06:59:24.728 (9,19): error CS1929: 'HttpRequestMessage' does
not contain a definition for 'GetQueryNameValuePairs' and the best
extension method overload
'HttpRequestMessageExtensions.GetQueryNameValuePairs(HttpRequestMessage)'
requires a receiver of type 'HttpRequestMessage'
(and 3 other similar errors).
I don't really need to use those extension methods, and if I delete all code that calls them, instead I get errors about the version of System.Net.Http:
Exception during runtime resolution of assembly 'System.Net.Http,
Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a':
'System.BadImageFormatException: Cannot load a reference assembly for
execution.
at System.Reflection.RuntimeAssembly.nLoadFile(String path,
Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at
Microsoft.Azure.WebJobs.Script.Description.FunctionMetadataResolver.ResolveAssembly(String
assemblyName)
at
Microsoft.Azure.WebJobs.Script.Description.FunctionAssemblyLoadContext.ResolveAssembly(String
name)
at
Microsoft.Azure.WebJobs.Script.Description.FunctionAssemblyLoader.ResolveAssembly(Object
sender, ResolveEventArgs args)'
2016-12-21T07:00:00.522 Unable to find assembly 'System.Net.Http,
Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Are you missing a private assembly file?
When NuGet adds the EntityFrameworkCore package, it installs System.Net.Http version 4.3.0, whereas Azure Functions seems to be looking for the hardcoded version 4.1.1.
I see questions about using EF6 with Azure Functions, but I don't see anything about EF Core.
one solution is changing from Azure Function v2 core to Azure Function v1 framework.

System.IO.FileNotFoundException Could not load assembly System.Drawing

I meet this error in a Xamarin.forms project using WebView and local html base url:
Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't
exist in the Mono for Android profile? Nom de fichier :
'System.Drawing.dll' à
Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference
reference, ReaderParameters parameters) à
Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1
assemblies, AssemblyDefinition assembly, Boolean topLevel) à
Xamarin.Android.Tasks.ResolveAssemblies.Execute() Almicantarat.Droid
I read that:
System.IO.FileNotFoundException: Could not load assembly System.Web in Mono for Android
but I don't know which client's source code I should compile.
I read that:
Could not load file or assembly 'System.Drawing, Version=4.0.0.0
but in my project, there is no reference to System.Drawing !!
See my references:
my android project references
Solved:
-> Close the solution
-> Delete all contents of the Packages folder (all the DLL's referenced through Nuget)
-> Restart the solution
-> Build (this will cause Nuget to get all DLL's again based on the packages.config)

Entity Framework 7 with Universal Windows Platform Add-Migration

I'm trying to implement Universal Windows Platform application with EntityFramework and SQLite (according to: http://ef.readthedocs.org/en/latest/platforms/uwp/getting-started.html) but I have problem with Add-Migration command.
Here is my setup:
Visual Studio 2015 Update 1
EntityFramework.SQLite: "7.0.0-rc1-final"
Error that I got while adding migrations is:
Could not load file or assembly 'System.Collections.Immutable, Version=1.1.36.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Thanks in advance for your help!
It is clearly that you miss a dll "System.Collections.Immutable, Version=1.1.36.0" in your project.
To solve this problem, you can open the Nuget tool, and search for System.Collections.Immutable, then in the "Version" label select the Version 1.1.36, by default it is the latest version 1.1.37.
You can also try to update your VS tool, this possible may also solve your problem.

How do I reference a UWP+NET46 portable library from a .NET 4.6 console application?

I have a portable class library project that targets .NET 4.6 and Universal Windows Platform. This class library contains just one class with the following line of code in its constructor:
Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
Now I create a new .NET 4.6 console application project in the same solution and add a project reference to the portable class library. Calling the method that houses the above line of code results in the following exception at runtime:
Could not load file or assembly 'System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
What am I doing wrong here? There are no compile-time errors or warnings.
Things I have tried: add missing(?) NuGet package manually
It seems that System.IO.FileSystem is a library delivered via NuGet, as part of the Microsoft.NETCore mega-package. Okay, perhaps I need to explicitly add this package to any project that uses my portable class library. I attempt to do so.
Could not install package 'Microsoft.NETCore.Platforms 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
No luck with this approach.
Things I have tried: create a project.json file
While there is no clear info on the web, I read a few tidbits about a new project.json based NuGet harness or build system. Just to experiment, I created the following project.json file in my console application project:
{
"dependencies": {
},
"frameworks": {
"net46": { }
},
"runtimes": {
"win-anycpu": { }
}
}
It works! The runtime error goes away! However, I soon found that this was either not the right solution or not a complete solution. I started writing some code to read configuration section values, which involved making use of the IConfigurationSectionHandler interface, and got the following compile-time error:
error CS0246: The type or namespace name 'IConfigurationSectionHandler' could not be found (are you missing a using directive or an assembly reference?)
This interface is part of the System assembly. I see a reference to this assembly, but it has a yellow exclamation mark icon, and a warning appears in the warnings window:
The referenced component 'System' could not be found.
This is where I ran out of ideas. Am I missing something totally obvious?
I have found the solution. My initial attempt was to install the Microsoft.NETCore package into the console application, resulting in the error shown in my original post.
However, if I install only the narrowly-scoped packages, e.g. System.IO.FileSystem, then I achieve success and the application works correctly. Apparently there is something special about the Microsoft.NETCore "master package" that prevents it from correctly installing into dependent projects.