Silencing "An unhandled exception of type 'System.ExecutionEngineException' occurred in Unknown Module" error
@Tyress, you cannot turn off notifications for unhandled exceptions while debugging. Since unhandled exceptions typically result in application crashes, the debugger will always break when they are encountered.
An unhandled exception of type 'System.ExecutionEngineException' occurred in XXX.exe
I got the same problem with this code:
[DllImport("camapi.dll", CharSet = CharSet.Unicode)]
private static extern CSTATUS_T CWRAPPER_GetFriendlyName(IntPtr pCameraBus, string sCamID, out StringBuilder sFriendlyName,
uint uBufferSizeInWords);
public static string CWRAPPER_GetFriendlyName(IntPtr pCameraBus, string sCamID)
{
var sFriendlyName = new StringBuilder(256);
var status = CWRAPPER_GetFriendlyName(pCameraBus, sCamID, out sFriendlyName, (uint)s.Capacity + 1);
return (status == CSTATUS_T.CSTATUS_SUCCESS) ? sFriendlyName.ToString() : "";
}
The problem was the "out" keyword. The example on MSDN doesn't have the 'out'.
Hope that helps someone...
Simon
System.ExecutionEngineException on Windows 10 device
Finally I managed to fix the code. However the error wasn't in the code above. I used something called "Safe Navigation". The example is shown in the code below:
Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
rootFrame.Navigate(typeof(MainPage));
});
I also handled all asynchronous methods with await
operator (I had left some of them before to run asynchronously). One of those improvements fixed the error.
System.AccessViolationException or System.ExecutionEngineException crash in SQLitePCLRaw.provider.e_sqlite3.dll with multiple thread access
Answer that solved this problem for me:
- I noticed that the dll the exception came from was SQLitePCLRaw.provider.e_sqlite3.dll. That led me to looking at what actually sets up the low-level SQLite library, and it is ultimately the call to
SQLitePCL.Batteries_V2.Init();
that selects the platform-specific low-level SQLite provider to be used. Could that be wrong?- Yes; it turns out that after reading through the wiki info at https://github.com/ericsink/SQLitePCL.raw/wiki/SQLitePCL.Batteries.Init#what-does-batteries_v2init-do that the call to
SQLitePCL.Batteries_V2.Init
was intended to be done only once per platform (either in platform specific code, or in the shared code as long asMicrosoft.EntityFrameworkCore.Sqlite
is installed in the shared project as well as each platform specific project). MySQLitePCL.Batteries.Init
usage was incorrectly insideOnConfiguring
inFooDbContext
, which made it called once per configuring of aFooDbContext
instead of only being done once per app startup. Moving theSQLitePCL.Batteries_V2.Init();
line out ofOnConfiguring
, and into theApp.xaml.cs
constructor in my shared project fixed it! The crashes no longer occurred after the interrupting thread's data access. I really hope this saves someone the huge hassle it saved me trying to get to the bottom of this.
- Yes; it turns out that after reading through the wiki info at https://github.com/ericsink/SQLitePCL.raw/wiki/SQLitePCL.Batteries.Init#what-does-batteries_v2init-do that the call to
Related Topics
How to Cast Object to List<Object> and Turn It into an Array
Entity Framework Core With Multiple Foreign Key on Same Column
Check If Task Is Already Running Before Starting New
How to Create ASP.NET Identity Tables in an Already Created Database Using Code First
Automapper - Map Using the Same Source and Destination Object Types
How to Upload a Excel File to SQL Database Table Using C# Windows Form Application
Asp.Net Core API Post Parameter Is Always Null
Microsoft Azure: How to Create Sub Directory in a Blob Container
Convert Dictionary Values into Array
How to Automatically Increment Numbers in C#
How to Insert Programmatically a New Line in an Excel Cell in C#
Documentdb With Azure Functions
Deserialize Multiple Xml Elements With the Same Name Through Xmlserializer Class in C#
Generate All Combinations from Multiple (N) Lists
How to Specify the Linq Orderby Argument Dynamically
Checking Whether a Number Contains Numbers 1 to N as Factors
How to Turn Off Brackets/Quotes Auto-Completion in Visual Studio