0
votes

I've been stuck with this compiler error for a while now, my project is a UWP Universal Windows Platform, with Xamarin.Forms 4.1, along with a set of nuget packages, and for some time when enabled the .NET Native tool chain option I get the following error:

C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\IlcInternals.targets(936,5): error : Internal compiler error: MCG0024:UnresolvableTypeReference Unresolvable type reference 'System.Runtime.InteropServices.HandleRef' in 'Assembly(Name=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)' found. Please check the references in your build system. A reference is either missing or an assembly is missing an expected type.

I've tried a set of solutions, updating Visual Studio to Update 3, UWP Developer Tools 1.4 with no success, the error remains the same... the only way to get rid of this error is compiling without the .NET Native options, but that's not an a option since we need to need to pass the Windows Certification thing...

Any clues?

2
It is entirely normal, HandleRef is not available in .NETCore. And can't be, it is a wrapper for a winapi handle, not the kind of animal you could ever use on OSX or Linux. WACK might provide more info about the bad assembly that brings this in. - Hans Passant
Ok, I understand that, but I do not use HandleRef in my code, even if I wanted to, UWP does not let me add references to native code, and the error occurs when building the project not at the WACK validation. - Brizio

2 Answers

0
votes

Finally got it working after some time searching for the problem. Found out there that was a reference to System.Drawing and System.Windows.Forms in a UWP project, quite obvious but not my fault, some other developer put it there. Actually there wasn't any coding using those assemblies, only the project reference, I believe that it was put there by mistake, probably when Visual Studio gives you hints/code assistance for missing types/class names.

0
votes

If anyone has this problem, also please make sure the dependency components(from Nuget) are not causing this problem. (You could remove it from Nuget and check the problem resolve or not).