-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EFCore 9.0 AccessViolationException #35331
Comments
@TonyValenti Need a bit more information - so the question is, what is your code doing when it calls EF Core? Looking at the stack trace we have the following 2 lines just before any EF Core calls
This is your code so we need to know what you are trying to do there. As a tip, your entry point to EF Cre in thsi case seems to be the call to |
To add to @ChrisJollyAU's answer, EF itself does not contain or invoke any native code (which is the only way an AccessViolationException would be triggered); the database provider (e.g. SqlClient in this case) may do native calls, but that's outside of EF's scope. With such memory corruption issues, an application bug completely unrelated to EF could cause memory corruption that would manifest as an access violation with an EF stack trace, even if EF itself has nothing to do with it - basically anything's possible once you have a native memory corruption. I'd advise first trying to understand where native calls are being done in your applicaiton, and ideally trying to isolate some sort of repro - that's of course very hard as the errors are sporadic, though a test that loops many items over the problematic code can sometimes semi-reliably trigger the error etc. |
If there's some issue that's causing this it would be in .NET runtime. Make sure to use the latest one and if you are still getting it try to create a minimal repro |
File a bug
Hi .NET and EFCore Team:
Since upgrading to .NET 9.0 and EFCore 9.0, we are sporadically getting AccessViolationExceptions which seem to stem from EFCore.
Include your code
I'm not sure about specifics of the code that is causing this as it seems to be all EFCore related
Include stack traces
Here is the error information from the Windows system logs:
Include provider and version information
EF Core version: 9.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer)
Target framework: .NET 9.0
Operating system: Win11
IDE: N/A
The text was updated successfully, but these errors were encountered: