Closed hypercode-go closed 4 months ago
I'm unable to reproduce it. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.
Exception thrown: 'System.InvalidOperationException' in WinRT.Runtime.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in System.Private.CoreLib.dll
I was able to run your application just fine:
It is probably something with your environment. Or it might be some combination of factors. But without something we can reproduce on our side, it will be difficult to create and validate some fix.
In my case, it can run if the target OS version is Windows 7 or 8 or if Exception sttings -> System.InvalidOperationException is disabled in Visual Studio.
However, if the Target OS Version is increased to Windows 10.0.17763.0 or higher, the output shows that a System.InvalidOperationException occurred.
The project I am currently developing requires Windows 10.0.17763.0 or higher, so I cannot ignore the exception.
Thank you for your reply.
I'm running it on Windows 11 (22631.3737) with net8.0-windows10.0.19041.0
(the version you provided in the repro).
thank you The environment was the same, but an exception occurred only on my PC, so I reinstalled Visual Studio. Now no exception is thrown.
Ask a question
EntityFramework.Docs/samples/core/WinForms/GetStartedWinForms/ used the code here. and modified environment. NET 8.0, EF Core 8.0.6 Target OS Version 10.0.19041.0 An System.InvalidOperationException, System.Reflection.TargetInvocationException occurred in the call of the EnsureCreated() function. This did not occur under target OS version 10. (ex: OS Version 7 or 8) May I know the cause?
Include code
Source link
EntityFramework.Docs/samples/core/WinForms/GetStartedWinForms/
ProductsContext.cs
Form1.cs
Include stack traces
Include verbose output
version information
EF Core version:8.0.6 Database provider: Microsoft.EntityFrameworkCore.Sqlite Target framework: NET 8.0 Target OS Version: 10.0.19041.0 Operating system: win 11 IDE: Visual Studio 2022 17.10.2