DEBUG and RELEASE modeAs the title says, I can't build an UWP app in Release mode once I reference the ImageSharp library. I've tested both with the .NETCore.UWP package version 6.1.9, 6.2.2 and 6.2.3, none of them worked.
I've also looked at this issue (#198) and only tried to build in x64, but the problem is still there.
These are the two errors I'm getting:
ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler2.2.1\tools\x64ilc\Tools\nutc_driver.exe @"C:\Users\Sergi\source\repos\ImageSharpRepro\ImageSharpReproobj\x64\Releaseilcintermediate\MDIL\ImageSharpRepro.rsp"' returned exit code 1
Error: NUTC3033:Internal Compiler Error: Invalid MethodImpl body=6000353 decl=600032d when loading type 'SixLabors.ImageSharp.Processing.Processors.Quantization.PaletteQuantizer
1<TPixel>' from assembly 'SixLabors.ImageSharp' while loading MethodImpl list for 'instance SixLabors.ImageSharp.Processing.Processors.Quantization.IFrameQuantizer1SixLabors.ImageSharp.Processing.Processors.Quantization.PaletteQuantizer 1<TPixel>.SixLabors.ImageSharp.Processing.Processors.Quantization.IQuantizer.CreateFrameQuantizer<TPixel1>(SixLabors.ImageSharp.Configuration)'. while loading type 'SixLabors.ImageSharp.Processing.Processors.Quantization.PaletteQuantizer1'. while computing compilation roots.
As mentioned in the title, the issue is only there in Release mode, while the Debug build works just fine.
1.0.0-beta0006)Windows 10 17763.x x64, but I should note I have the same issue on the CI build I have set up for my project, so this doesn't seem to be a problem specific to my configuration.
1.0.0-beta0006I'm also going to send a repro to the .NET Native team, in case there's something they can do as well.
Will post an update here as soon as I hear back from them.
Small update, I received no reply from the .NET Native so far and I've proceeded to open an issue on the CoreRT repo as well (as I believe the .NET Native folks usually monitor that repo).
If anyone else is interested in this issue (am I really the only UWP dev using this lib?), you can follow both issues, the one in CoreRT is right over this message 馃槃
Looks like an AOT compilation issue to me, similar to the mono/Xamarin ones.
I wonder whether the workaround we provided in #767 and #785 helps.
Hey @antonfirsov - thank you for your reply!
I've tried that in my app (I'm only using the Argb32 type, so I just added the AotCompilerTools.Seed<Argb32>() call in my app constructor), but I got the same error 馃槦
I want to note though that as I've mentioned in my first post, the compile error happens even with no code at all that references the library in my app. I mean, as soon as you reference ImageSharp, without actually using it at all, the .NET Native compiler breaks with those errors mentioned above.
I've asked the guys in the CoreRT repo if they can test this with a pre-release build of the upcoming .NETCore.UWP package, which should come out in a couple months or so and should include a new version of the .NET Native compiler, and see if the issue is solved there.
If it isn't, I hope they'll be able to at least provide a workaround at this point 馃槙
Thank you again for your help!
Beginning to really dislike the disconnect between MS dev teams and technologies.
Hello! I work on the .NET team and this looks like something we'll need to get investigated. I've cut a bug in our internal bug db (#786375 if that's ever helpful during followup). It's currently assigned to one of the project leads so that it can get routed/triaged/fixed.
I see other ImageSharp issue in our DB that are marked as fixed. Have y'all ever managed to get a version of this building for Release UWP?
Hey @MattWhilden - glad to hear from you again!
I'm happy to hear this is currently being investigated, I'm looking forward to hearing some news about this, or even a possible workaround.
As for your question, this is the first time I've ever used ImageSharp on UWP, but hopefully someone from the ImageSharp team will be able to provide more info on previous attempts to run this combination.
Thank you again for looking into this! 馃槃
I see other ImageSharp issue in our DB that are marked as fixed. Have y'all ever managed to get a version of this building for Release UWP?
@MattWhilden I can't be sure that anyone actually has, in fact, I doubt very much someone has. We have some older issues that I closed due to a lack of support on the UWP side not ours.
Appreciate the info. Going in to an investigation know that there may be other lurking things is often quite helpful!
Hey @MattWhilden - any news?
I was wondering if you guys had time to start looking into this and if you managed to find out what is causing the issue. Thanks again! 馃槃
I'll have to follow up with the person working on it and let you know. I don't know that I can catch them today but definitely Monday.
@MattWhilden Sounds great, thank you so much for following up on this, I really appreciate it! 馃槉
Hey @MattWhilden - sorry to bother, have you heard anything about this?
Any chance a fix for this could be included in the upcoming .NETCore.UWP 6.2.4 package?
Or, I would also be fine with some temporary workaround, maybe some compiler directives to add to the .rd.xml file to make ilc.exe ignore the errors in that specific method (as I'm not using that anyway), if something like this was possible (not sure if the error actually involves multiple files and VS is only showing that one in the output window)?
Even knowing an approximate ETA for a fix would help, as right now every single time I want to build a package for the Store I have to go through my code and remove all ImageSharp references, and for this reason I can't proceed to use the library in more places in my app either, as that would make building new packages even more difficult.
Same bug in my UWP app in release x64 config, but downgrading to 1.0.0-beta0005 builds fine.
@cie6868 Had no idea downgrading worked, I'll try that, thanks!
Also, FYI this bug has already been fixed by the .NET Native team, so right now we just need them to include it in the next .NETCore.UWP package update. Hopefully it'll be out soon 馃槙
Sigh.... Don鈥檛 downgrade, now you鈥檝e introduced 100s of other bugs
@JimBobSquarePants I meant to say I'd try that just to confirm it doesn't cause a crash, I'm not really going to use a months old package in a production app 馃槃
I mean, lacking ImageSharp entirely for now is annoying, but it's still better than introducing more crashes due to an old beta build ahahahahah
I really hope the .NET Native patch is release soon though 馃槅
It鈥檚 a shame their release cadence is not a bit faster. Though I can鈥檛 talk, it鈥檚 been 4 months since we did a release.
Yeah that's a shame, especially because they were actually pretty fast once they started investigating the issue. My guess is that it's not really up to them, I imagine there are quite a few different teams involved in each .NETCore.UWP package, as it includes both the whole .NET Native toolchain as well as updates to all the various core libraries.
I'll try to ping the .NET Native team again and see if they have any news 馃槉
Good idea. Fingers crossed!
Hi @Sergio0694 , could you solve the problem? I have a similar problem but with another plugin 'PdfSharpCore' that makes use of this library.
Hey @ivanrlg - unfortunately the fix hasn't been pushed yet, no.
Last time I spoke with the .NET Naative team they confirmed they had in fact already fixed the issue and merged it into their master branch, but after that I guess it's out of their hands and it's just a matter of when MS/some other team decides to push out a new .NETCore.UWP NuGet package.
Since 6.2.8 was released 5 months ago, and 6.1.9 on October 2018, I'm hoping a new update will be released at some point this fall, but I don't know anything for sure unfortunately. 馃槦
We're grinding through validation and things are going smoothly. I hate to say actual dates before it's completely inevitable though...
If your timelines are really tight and getting you a hacked version is helpful I'm happy to look in to that.
Oh, what fortuitous timing. Right after I posted this a mail showed up titled "Review release notes" which is darn near the end of the train to get things shipped. I'd be pretty surprised if we didn't get this up by the end of the week (but don't quote me on that!)
Hey @MattWhilden - great to hear from you again, and thank you for the good news! 馃槃
Looking forward for this new update to be shipped then!
6.2.9 is now available on Nuget. Let me know how it goes.
Release notes also up: https://github.com/microsoft/dotnet/tree/master/releases/UWP/net-native2.2
I can't believe this is finally happening, just tried it and it works perfectly! 馃帀
Thank you @MattWhilden and the whole team for taking the time to address this!
@JimBobSquarePants @antonfirsov I can confirm that ImageSharp now works just fine at least in Release x64 on UWP (see #987).
Wonderful news. Do let us know if you have other issues. Happy to help.
Hi, I think my case was not successful when compiling the release version x86 / x64, I can only compile the Debug version. The nutget that I am using is not exactly "ImageSharp" but the compilation error I have is very similar to the one referred to in this thread. This problem happens just by adding the nutget "PdfSharpCore" which I think refers to some element of "ImageSharp". In the same way I opened a case on the project page, but I have a feeling that I will not get an answer by that means that is why I refer it here. I hope you can help me, at least you can check it out.
Greetings. https://github.com/ststeiger/PdfSharpCore/issues/48 @MattWhilden @Sergio0694
Hey @ivanrlg - it looks like that PdfSharpCore package is in fact referencing ImageSharp, which is why you have the same issue. If you upgrade to .NETCore.UWP version 6.2.9 you should be able to build in Release x64 (it works for me and other devs).
Release x86 is the only remaining broken profile, and we're tracking that in #987.
Thank you very much for responding, unfortunately in my case the update did not work, neither for x86 nor x64 @Sergio0694
@ivanrlg not building for x64 would be surprising if are you on 6.2.9 of Micorosoft.NETCore.WindowsUniversalPlatform and have an osMinVer of at least 16299.
Is that the case?
@ivanrlg not building for x64 would be surprising if are you on 6.2.9 of Micorosoft.NETCore.WindowsUniversalPlatform and have an osMinVer of at least 16299.
Is that the case?
Hi, thank you very much for answering. If it is correct, the version I am using is 17763. Only to include the PDFSharpcore package without adding a single line of code does that error occur in release mode, in debug mode it does not happen.
I'm able to build Release x64 with the following steps. Let me know how this differs from your setup.
- Update Microsoft.NETCore.UniversalWindowsPlatform to 6.2.9
Hello, thanks again for responding and being attentive. It's quite strange, it's really not exactly how you do it, but very similar, I work with a Xamarin Forms project. I did the following create a new Xamarin project, add the library "PdfSharpCore" update the Microsoft.NETCore.UniversalWindowsPlatform package to 6.2.9, switch to Release X64 and it worked perfectly. But if I do the same with my multi-month project, I get the error just by adding the "PDFSharpCore" package without adding a line of code.
I share the output.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : Type 'ZXing.QrCode.Internal.ErrorCorrectionLevel' from assembly 'ZXing' was not included in compilation, but was referenced in method 'bi.b(List<byte>, IBuffer, QrCodeModel, QrCodeLevel, int, int)'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : Type 'ZXing.QrCode.Internal.ErrorCorrectionLevel' from assembly 'ZXing' was not included in compilation, but was referenced in method 'bi.b(List<byte>, IBuffer, QrCodeModel, QrCodeLevel, int, int)'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : Type 'ZXing.Rendering.PixelData' from assembly 'ZXing' was not included in compilation, but was referenced in method 'bi.b(List<byte>, IBuffer, QrCodeModel, QrCodeLevel, int, int)'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : Method 'bi.b(List<byte>, IBuffer, QrCodeModel, QrCodeLevel, int, int)' will always throw an exception due to the missing method 'ErrorCorrectionLevel.get_L()' in assembly 'ZXing'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : Type 'ZXing.EncodeHintType' from assembly 'ZXing' was not included in compilation, but was referenced in the application. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : Type 'ZXing.Rendering.PixelData' from assembly 'ZXing' was not included in compilation, but was referenced in method 'bi.b(List<byte>, IBuffer, QrCodeModel, QrCodeLevel, int, int)'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : Method 'bi.b(List<byte>, IBuffer, QrCodeModel, QrCodeLevel, int, int)' will always throw an exception due to the missing method 'ErrorCorrectionLevel.get_L()' in assembly 'ZXing'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : Type 'ZXing.EncodeHintType' from assembly 'ZXing' was not included in compilation, but was referenced in the application. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
4>C:\Users\Ivan Labradorr\.nuget\packages\microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\Microsoft.NetNative.targets(801,5): error : ILT0005: 'C:\Users\Ivan Labradorr\.nuget\packages\runtime.win10-x64.microsoft.net.native.compiler\2.2.7-rel-27913-00\tools\x64\ilc\Tools\nutc_driver.exe @"C:\Users\Ivan Labradorr\source\repos\CinarucoProject\cinarucoproject\Cinaruco\Cinaruco.UWP\obj\x64\Release\ilc\intermediate\MDIL\Cinaruco.UWP.rsp"' returned exit code 1
I am using VS2019 16.2.3.
I share the references of my root project:
<ItemGroup>
<PackageReference Include="Acr.UserDialogs" Version="7.0.26" />
<PackageReference Include="Behaviors.Forms" Version="1.4.0" />
<PackageReference Include="CsvHelper" Version="12.1.2" />
<PackageReference Include="DocumentFormat.OpenXml" Version="2.9.1" />
<PackageReference Include="Microcharts" Version="0.7.1" />
<PackageReference Include="Microcharts.Forms" Version="0.7.1" />
<PackageReference Include="Microsoft.AppCenter" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="2.1.1" />
<PackageReference Include="Microsoft.Azure.ActiveDirectory.GraphClient" Version="2.1.1" />
<PackageReference Include="Microsoft.Azure.Mobile.Client" Version="4.1.1" />
<PackageReference Include="Microsoft.Azure.Mobile.Client.SQLiteStore" Version="4.1.1" />
<PackageReference Include="Microsoft.Identity.Client" Version="1.0.304142221-alpha" />
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="PdfSharpCore" Version="1.1.12" />
<PackageReference Include="Rg.Plugins.Popup" Version="1.1.5.188" />
<PackageReference Include="sqlite-net-pcl" Version="1.5.231" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
<PackageReference Include="Xam.Plugin.Connectivity" Version="4.0.0.190-beta" />
<PackageReference Include="Xam.Plugin.Media" Version="4.0.1.5" />
<PackageReference Include="Xam.Plugins.Forms.ImageCircle" Version="3.0.0.5" />
<PackageReference Include="Xam.Plugins.Settings" Version="3.1.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.0" />
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
<PackageReference Include="Xamarin.Plugin.FilePicker" Version="2.1.18" />
</ItemGroup>
and those of my UWP project
<ItemGroup>
<PackageReference Include="Acr.UserDialogs">
<Version>7.0.26</Version>
</PackageReference>
<PackageReference Include="CsvHelper">
<Version>12.1.2</Version>
</PackageReference>
<PackageReference Include="DocumentFormat.OpenXml">
<Version>2.9.1</Version>
</PackageReference>
<PackageReference Include="Microcharts">
<Version>0.7.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Azure.ActiveDirectory.GraphClient">
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Azure.Mobile.Client">
<Version>4.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Azure.Mobile.Client.SQLiteStore">
<Version>4.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Identity.Client">
<Version>1.0.304142221-alpha</Version>
</PackageReference>
<PackageReference Include="MvvmLightLibsStd10">
<Version>5.4.1.1</Version>
</PackageReference>
<PackageReference Include="NETStandard.Library">
<Version>2.0.3</Version>
</PackageReference>
<PackageReference Include="PdfSharpCore">
<Version>1.1.12</Version>
</PackageReference>
<PackageReference Include="Rg.Plugins.Popup">
<Version>1.1.5.188</Version>
</PackageReference>
<PackageReference Include="sqlite-net-pcl">
<Version>1.5.231</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.Connectivity">
<Version>4.0.0.190-beta</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.Media">
<Version>4.0.1.5</Version>
</PackageReference>
<PackageReference Include="Xam.Plugins.Forms.ImageCircle">
<Version>3.0.0.5</Version>
</PackageReference>
<PackageReference Include="Xam.Plugins.Settings">
<Version>3.1.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Essentials">
<Version>1.3.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.9" />
<PackageReference Include="Xamarin.Plugin.FilePicker">
<Version>2.1.18</Version>
</PackageReference>
</ItemGroup>
I probably damaged some configuration of the project trying to make it compile before reaching this thread or maybe there is some conflict with some of the packages that I have installed.
If there is any other information that I can provide you, I will be pending.
Hello again, after a couple of hours trying, cleaning disused packages such as "sqlite-net-pcl", Microsoft.Azure.ActiveDirectory.GraphClient "and" Xam.Plugins.Settings "and changing settings I managed to compile in release mode, I am honestly not sure what the exact cause was that I was generating the compilation error and I am sorry to say it for not being very professional on my part but in the end it has worked. Sorry for the time I have taken from you. @MattWhilden
@ivanrlg no worries at all. I'm quite happy to hear you're back on your feet and able to make progress. I have a theory about what your other error could have been so I'll put some extra info here in case it's helpful. If you end up having other .NET Native issues I can be reached directly via [email protected] (but I suspect the ImageSharp folks don't mind a bit of back and forth here) 馃槃
Anyhow, I hope everything else goes smoothly with your development. Certainly let me know if you see anything else that's unexpected. Happy to help!
The Theory
I suspect that the issue from above is that the optimizer (nutc_driver) hit an out of memory condition which failed compilation.
The Clues
The optimizer is the greediest piece of the compiler and this isn't a completely uncommon thing to have happen. You can see me talking about a different circumstance of this kind of error with another developer here. It'll kick out error code '1' for other reasons but this is the most common.
Suggestions
The easiest workaround for most folks is to enable the 64 bit compiled version of nutc_driver.exe. It's available to everyone running on 6.X+ of Microsoft.NETCore.UniversalWindowsPlatform AND a minOSVersion of 16299+. You can enable it by setting this flag in the global properties of your csproj:
<Use64BitCompiler>true</Use64BitCompiler>
The linked StackOverflow post has a slightly different issue but setting the optimizer to run as single threaded is another way folks can help reduce memory pressure within the compiler. It's not my preferred way of doing things because it can dramatically increase the amount of time your application takes to build... but if you end up stuck, it's a nice flag to know about.
@MattWhilden Hi, I am getting below error on my UWP build for release mode with ImageSharp Only.
After removing ImageSharp its building fine.
Min SKD Build : 16299
Microsoft.NETCore.UniversalWindowsPlatform : 6.2.9
Using Setting in csproj file : <Use64Bitcompiler>true</Use64Bitcompiler>
Severity Code Description Project File Line Suppression State
Error ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x86.microsoft.net.native.compiler2.2.7-rel-27913-00\tools\x86ilc\Tools64\nutc_driver.exe @"C:\AIGit\GoodsManV2\GoodsMan\GoodsMan.UWPobj\x86\Releaseilcintermediate\MDIL\GoodsMan.UWP.rsp"' returned exit code -1073740791 GoodsMan.UWP
@MattWhilden & @JimBobSquarePants
Just to update the progress Its building fine for x64 Release mode but not for the x86 Release mode
We need someone to raise an issue upstream here for us to track. We can't fix issues with the AOT compiler.
@Sergio0694 Is this still valid? I thought we'd defeated all the UWP build issues?
@JimBobSquarePants The original issue was indeed fixed, you reopened this a while back after @AwsomeCode reported a somewhat related (possibly?) issue. But I can confirm that the original issue here was indeed fixed months ago, yeah 馃憤
I am using ImageSharp in one of my apps and it builds just fine in Release x86, x64 and ARM64.
Sweet. Closing!
Most helpful comment
6.2.9 is now available on Nuget. Let me know how it goes.
Release notes also up: https://github.com/microsoft/dotnet/tree/master/releases/UWP/net-native2.2