Bug 52482 - System.IO.FileNotFoundException in mscorlib.ni.dll Could not load clrcompression on UWP Xamarin Forms Init?
Summary: System.IO.FileNotFoundException in mscorlib.ni.dll Could not load clrcompress...
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-13 20:46 UTC by Russell Fustino
Modified: 2017-06-20 15:54 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Screenshot of "Break When Thrown" for Common Language Runtime exceptions (12.09 KB, image/png)
2017-02-28 04:29 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Russell Fustino 2017-02-13 20:46:15 UTC
Why is this happening for my UWP project at runtime in the forms.init call? I started getting a similar error when I did a store build. It could not find System.Private.Reflection.Core.dll instead of mscorlib.ni.dll in release mode. It builds ok, but I get the runtime error when running the release mode. So, I went back to debug mode and stated getting the error on mscorlib.nio.dll. I reverted back to my last good build on TFS and I am still getting these errors. In debug mode, mscorlib.ni.dll and release mode, system.private.reflection.dll. I have cleaned, deleted obj and bin, rebuilt to no avail. This has me stumped. anyone else having this? Another clue, The store build kind of runs, but my images on the home page are missing, they are embedded resources. For the release build I have tried to load the assemblies, but I am having a hard time knowing what the exact mane of the assemblies are. For debug, it used to in as is, with no assemblies loaded before the init. Here is what I found on this topic and tried all suggestions in these posts. Not sure how to determine all the assemblies needed for release mode, how does one know what to put in there? Here is what I have so far for the release mode problem, but I am shooting in the dark as I am not sure if these are correct nor complete.

var otherAssemblies = new[] {
                typeof(MR.Gestures.ContentPage).GetTypeInfo().Assembly,
                typeof(MR.Gestures.UWP.Renderers.PageRenderer).GetTypeInfo().Assembly,
                typeof(HomePage).GetTypeInfo().Assembly,
                typeof(ImageCircle.Forms.Plugin.UWP.ImageCircleRenderer).GetTypeInfo().Assembly,
                typeof(Telerik.XamarinForms.Common.UWP.TelerikForms).GetTypeInfo().Assembly,
                typeof(Telerik.XamarinForms.Common.UWP.RadViewContainer).GetTypeInfo().Assembly,
                typeof(SQLite.SQLite3).GetTypeInfo().Assembly,
                typeof(Telerik.XamarinForms.DataControls.RadListView).GetTypeInfo().Assembly,
                typeof(Telerik.XamarinForms.DataControlsRenderer.UWP.ListViewRenderer).GetTypeInfo().Assembly,
                typeof(Telerik.XamarinForms.DataControls.ListView.ListViewGridLayout).GetTypeInfo().Assembly,
            };
            Xamarin.Forms.Forms.Init(e, otherAssemblies);

Other links, tried these as well:
https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/#Target_Invocation_Exception_when_using_Compile_with_.NET_Native_tool_chain
https://forums.xamarin.com/discussion/comment/246158
and another one: [Why does my Xamarin PCL throw a runtime exception when Building release for Universal App? Any other ideas? I cannot even run the app in debug mode now

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Architecture and Modeling Tools   00322-90150-02402-AA447
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015   00322-90150-02402-AA447
Microsoft Visual Basic 2015

Visual C# 2015   00322-90150-02402-AA447
Microsoft Visual C# 2015

Visual C++ 2015   00322-90150-02402-AA447
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-90150-02402-AA447
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   7.17.00119.9
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Clang with Microsoft CodeGen   14.0.25516
Clang with Microsoft CodeGen

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GeneratorWindow Extension   1.0
GeneratorWindow Visual Stuido Extension Detailed Info

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

KofePackagePackage Extension   1.0
KofePackagePackage Visual Studio Extension Detailed Info

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript   1.8.36.0
TypeScript tools for Visual Studio

Visual C++ for Cross Platform Mobile Development (Android)   14.0.25401.00
Visual C++ for Cross Platform Mobile Development (Android)

Visual C++ for Cross Platform Mobile Development (iOS)   14.0.25401.00
Visual C++ for Cross Platform Mobile Development (iOS)

Visual Studio Tools for Apache Cordova   Update 10
Visual Studio Tools for Apache Cordova

Visual Studio Tools for Universal Windows Apps   14.0.25527.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.2.2.11 (00fa5cc)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.2.42 (501e63c)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.3.1.8 (7beaef4)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2017-02-28 02:35:27 UTC
## Quick non-engineering team review

The summary of this bug currently says: "System.IO.FileNotFoundException in mscorlib.ni.dll Could not load clrcompression".  I suspect the important assembly name is "clrcompression" rather than either "mscorlib.ni.dll" or "System.Private.Reflection.Core.dll".  And that in turn sounds like a duplicate of either Bug 51565 or Bug 52838 (filed just today), depending on whether or not the debugger is set to break on all first-chance exceptions.




## Specific to one particular project, development computer, or target mobile device?

Unclear.  In the circumstances for Bug 52838 in particular, this exception is always a _handled_ exception.  If the exception is _unhandled_ in this Bug 52482, it is not yet clear how that is possible, unless perhaps the exception is being thrown from a different location than in Bug 52838.  The bug report does not currently include a test case or steps to reproduce that might allow the Xamarin team to study this issue locally.




## Considers the relevant log files and has them attached?

Not yet.  For example this report does not currently include the full exception message or stack trace of the exception.  Including the exact messages for each different failure scenario (for example, Debug vs. Release) would be appropriate.
Comment 2 Russell Fustino 2017-02-28 03:22:55 UTC
Thanks for the reply. I definitely need to figure this out within the next week to be able to publish to the store. I do not see an option in the debugger settings to break on all first-chance exceptions. Where is that? I tried to uncheck Break on all processes when one process breaks, but had the same result. I do have an update however, I downloaded the project fro TFS to a different laptop, my surface pro and I am able to run a debug again. I will compare all of the debugger settings in each soon. I am feaful however once I
Comment 3 Russell Fustino 2017-02-28 03:27:50 UTC
had a mid air colission when updating my comment ... here is the completed comment... Thanks for the reply. I definitely need to figure this out within the next week to be able to publish to the store. I do not see an option in the debugger settings, to break on all first-chance exceptions. Where is that? I tried to uncheck Break on all processes when one process breaks, but had the same result. I do have an update however, I downloaded the project from TFS to a different laptop, my surface pro and I am able to run a debug again. I will compare all of the debugger settings in each by tomorrow. I am fearful however once I do another store build on the surface pro, I will be in the same boat.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2017-02-28 04:29:10 UTC
Created attachment 20028 [details]
Screenshot of "Break When Thrown" for Common Language Runtime exceptions

Here's a quick screenshot of the checkbox for "Break When Thrown" (a better term than "first-chance" that I used before) in "Debug > Windows > Exception Settings" in VS 2015 Update 3.  The filled square is the default that breaks on unhandled exceptions.  The checkmark breaks on all thrown exceptions.

> I am fearful however once I do another store build on the surface pro,
> I will be in the same boat.

If you run into the same exception again, I would definitely recommend pasting back the full exception message and stack trace to make sure it is included in the bug report.
Comment 5 Russell Fustino 2017-02-28 07:31:28 UTC
That works! Now I can continue to develop and debug on my main machine. I would have never found that in a million years. I did not even know there was a Debug > Windows > Exception Settings section. We are coming up on the 20th anniversary of Visual Studio with vs 2017 and I have been using it for all twenty years. Learn something new every day! Please keep this open, as it is half the issue, with the first issue being not being able to run a store build. I will try to do a store build tomorrow and will supply the info you suggested if needed. Thank you once again, this was driving me nuts.
Comment 6 Shimmy 2017-06-07 21:43:43 UTC
Is this related: https://bugzilla.xamarin.com/show_bug.cgi?id=51796?
Comment 7 Shimmy 2017-06-19 19:18:08 UTC
Is this one related: https://bugzilla.xamarin.com/show_bug.cgi?id=57599?
Comment 8 Chris King 2017-06-20 15:26:06 UTC
David, over to you for routing.
Comment 9 David Ortinau [MSFT] 2017-06-20 15:54:12 UTC
Closing per #c5.