Home > Net >  UWP c# crashes with no debug output
UWP c# crashes with no debug output

Time:10-24

I just downloaded UWP/.NET to run some project I found of github.

private void onl oaded(object sender, RoutedEventArgs e)
{
    var button = null as Button;
    var b = button.CommandParameter;
    //throw new InvalidOperationException("Testing");
}

Throwing the exception breaks the program as expected. However, the null access crashes the app and the only debug output message I get is

The program '[12036] eReader.exe' has exited with code 2148734499 (0x80131623).

According to hresult.info 0x80131623 is Runtime operation halted by call to System.Environment.FailFast().

However, the original error that was crashing the app from a call to StorageFile.CopyAsync has now gone away, so I can no longer test the debugging configuration.

CodePudding user response:

The debugger now breaks on the null access. I've done nothing at all apart from recompiling minor changes and rerunning.

Just try again until it works?

Edit: actually it might have been moving the error from an async method to a synchronous method. Maybe visual studio needs to have an error in a synchronous method before it can handle errors in async methods.

Edit 2: perhaps it's because I tried to build before having .NET and UWP installed. I stopped the after the build was non-responsive and installed, but perhaps there were some complications.

  • Related