question

DeadStack avatar image
0 Votes"
DeadStack asked RoyLi-MSFT commented

Strange FileLoadExceptions

I have a small program that was working, I was generating assets in the manifest. Then I renamed the project, it also uses another library project of mine. Now it's not working, and I'm getting a lot of FileLoadExceptions as follows:

T: 3 | Graphics.Ctor T: 3 | Dx11.CreateDeviceResources T: 3 | RenderSurface.Ctor T: 3 | RenderSurface.BuildAsync T: 3 | MaterialTexture.BuildDefaultResourcesAsync Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll T: 3 | RasterizerStatePrefabs.BuildSolid T: 3 | RasterizerStatePrefabs.BuildWireframe Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll The program '[17656] UWPCameraPan.exe' has exited with code 1 (0x1).

I've seen many exceptions generated for each file exception, so there may be just 1 file issue and then all these errors being spat out. The Xaml runs but my code is crashing out. How can i debug this?


windows-uwpwindows-uwp-xaml
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I have questions about your issue. You said you are generating assets in the manifest, do you mean you are using the tools that generate the icons in Visual Assets? If not, could you please tell me what does it mean? You said you renamed the project? Did you also rename the folder of the project? Does your app crash when you launching the app?

0 Votes 0 ·

Hi,

So, yeah i was just talking about the VS tool that generates icons. But I've just recreated the project (As in .. New Project & copied code files over) and haven't touched the assets yet, and I'm seeing these errors still. The app starts, and the Xaml appears to be running, but my DirectX setup code crashes out because of these exceptions. Strangely, when I try to to switch to fullscreen the new app crashes to the app.g.i.cs the Break() in this system code ..

     partial class App : global::Windows.UI.Xaml.Application
     {
         // ...
         public void InitializeComponent()
         {
             // ..

 #if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
             UnhandledException += (sender, e) =>
             {
                 if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
             };
 #endif
         }
0 Votes 0 ·

It's strange that the new project will have the issue as well. Could you please tell me how you created the new app? Especially how you added the files from the old project?

0 Votes 0 ·
Show more comments
DeadStack avatar image
0 Votes"
DeadStack answered DeadStack edited

This started happening a week or so ago. I thought I'd stuffed something up, so I rebuilt a small project with just this one call to load a texture, and it's still happening. I'm starting to think this isn't my code and something in Visual Studio has broken. When i try to step into a function that is throwing the exception, the exception is thrown before any user code is executed in the function. I've put a break point on the first line in that fn and it's never reached.


 public static async Task<Texture> LoadTextureAsync(string debugName, Folders folder, string filePath)
 {
 BitmapSource bitmapSource = await LoadBitmapSourceAsync(folder, filePath);

When i try to step into the LoadBitmapSourceAsync method, having put a breakpoint inside that method on the first line of code I get the following output ..

Step into: Stepping over non-user code 'Engine.Core.FileIo.LoadBitmapSourceAsync'

Step into: Stepping over non-user code 'Engine.Core.FileIo.<LoadBitmapSourceAsync>d__5..ctor'

Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll

And execution has returned out to

 Texture texture = await FileIo.LoadTextureAsync(&#34;DebugTexture&#34;, Folders.Installation, &#34;Assets\\DwarfPortrait.png&#34;);



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

These forums can't handle any editing of a comment, I tried to remove an empty line a code section, and the entire comment was corrupted in several ways -
1)all code blocks were removed
2) quotes were replaced with & # 34
3) carriage returns were removed from the output lines, so the 3 lines were squashed together.

0 Votes 0 ·
DeadStack avatar image
0 Votes"
DeadStack answered RoyLi-MSFT commented

This is in debug mode. Changed to mixed mode debugging. This app does potentially call SharpDX. Although no SharpDX code get's a chance to run in this case. When i turned on mixed mode debugging, I get some extra output .. (note: I changed namespace here from core to serialization, it's not relevant, it was just a tidy up as i was looking through it)


Step into: Stepping over non-user code 'Engine.Serialization.FileIo.LoadBitmapSourceAsync'
Step into: Stepping over non-user code 'Engine.Serialization.FileIo.<LoadBitmapSourceAsync>d__5..ctor'
Exception thrown at 0x76BF4192 in DemoLoadingData.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0993B93C.
Exception thrown at 0x76BF4192 in DemoLoadingData.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x76BF4192 in DemoLoadingData.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x76BF4192 in DemoLoadingData.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown: 'System.IO.FileLoadException' in System.Private.CoreLib.dll


Further, this started happening across projects after I tried to prepare a small app for submission to the store. So I may have run some package generation tools in Visual Studio.


I don't get any Exception popups, i guess the exception is not being caught, and execution is falling out to the first calling function.


So when I run it in release, my breakpoint inside the LoadBitmapSourceAsync method is hit and i can step through the code without those exception. It seems to run normally until it reaches, in this case, an expected NullReferenceException, because I haven't setup WIC Factory.


I didn't even know breakpoints would work in release mode.

It only happens in Debug. I checked my other project and it's the same, it's working in release.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It's a strange issue. I'll ask other engineers to take a look at this.

0 Votes 0 ·
DeadStack avatar image
0 Votes"
DeadStack answered RoyLi-MSFT commented

Alright, after a little detour thinking I'd uncovered a related issue, and having it pointed out that I was doing something wrong, I've realized that this is complicated and there's a lot of my own convoluted code in between what's happening and a fix. So I'm working on isolating the problem and double checking my code here and there. This rings of an issue with async code where things can look good for a long time and suddenly stop working. I also got this error tonight ..

WinRT originate error - 0x80131040 : 'System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.WindowsRuntime, Version=4.0.15.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference.

So I'll post again after I've worked through a couple of things and when I can perhaps present a much clearer and minimal picture of the issue.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It looks like you've made some process about this issue and you asked another question there. My teammate replied to you in another question. Please check that.

0 Votes 0 ·