dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.77k stars 3.18k forks source link

System.InvalidOperationException in EnsureCreated() function #34094

Closed hypercode-go closed 4 months ago

hypercode-go commented 4 months ago

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

public class ProductsContext : DbContext
{
    public DbSet<Product> Products { get; set; }
    public DbSet<Category> Categories { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        => optionsBuilder.UseSqlite("Data Source=products.db");

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Category>().HasData(
            new Category { CategoryId = 1, Name = "Cheese" },
            new Category { CategoryId = 2, Name = "Meat" },
            new Category { CategoryId = 3, Name = "Fish" },
            new Category { CategoryId = 4, Name = "Bread" });

        modelBuilder.Entity<Product>().HasData(
            new Product { ProductId = 1, CategoryId = 1, Name = "Cheddar" },
            new Product { ProductId = 2, CategoryId = 1, Name = "Brie" },
            new Product { ProductId = 3, CategoryId = 1, Name = "Stilton" },
            new Product { ProductId = 4, CategoryId = 1, Name = "Cheshire" },
            new Product { ProductId = 5, CategoryId = 1, Name = "Swiss" },
            new Product { ProductId = 6, CategoryId = 1, Name = "Gruyere" },
            new Product { ProductId = 7, CategoryId = 1, Name = "Colby" },
            new Product { ProductId = 8, CategoryId = 1, Name = "Mozzela" },
            new Product { ProductId = 9, CategoryId = 1, Name = "Ricotta" },
            new Product { ProductId = 10, CategoryId = 1, Name = "Parmesan" },
            new Product { ProductId = 11, CategoryId = 2, Name = "Ham" },
            new Product { ProductId = 12, CategoryId = 2, Name = "Beef" },
            new Product { ProductId = 13, CategoryId = 2, Name = "Chicken" },
            new Product { ProductId = 14, CategoryId = 2, Name = "Turkey" },
            new Product { ProductId = 15, CategoryId = 2, Name = "Prosciutto" },
            new Product { ProductId = 16, CategoryId = 2, Name = "Bacon" },
            new Product { ProductId = 17, CategoryId = 2, Name = "Mutton" },
            new Product { ProductId = 18, CategoryId = 2, Name = "Pastrami" },
            new Product { ProductId = 19, CategoryId = 2, Name = "Hazlet" },
            new Product { ProductId = 20, CategoryId = 2, Name = "Salami" },
            new Product { ProductId = 21, CategoryId = 3, Name = "Salmon" },
            new Product { ProductId = 22, CategoryId = 3, Name = "Tuna" },
            new Product { ProductId = 23, CategoryId = 3, Name = "Mackerel" },
            new Product { ProductId = 24, CategoryId = 4, Name = "Rye" },
            new Product { ProductId = 25, CategoryId = 4, Name = "Wheat" },
            new Product { ProductId = 26, CategoryId = 4, Name = "Brioche" },
            new Product { ProductId = 27, CategoryId = 4, Name = "Naan" },
            new Product { ProductId = 28, CategoryId = 4, Name = "Focaccia" },
            new Product { ProductId = 29, CategoryId = 4, Name = "Malted" },
            new Product { ProductId = 30, CategoryId = 4, Name = "Sourdough" },
            new Product { ProductId = 31, CategoryId = 4, Name = "Corn" },
            new Product { ProductId = 32, CategoryId = 4, Name = "White" },
            new Product { ProductId = 33, CategoryId = 4, Name = "Soda" });
    }
}

Form1.cs

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.dbContext = new ProductsContext();

            // Uncomment the line below to start fresh with a new database.
            // this.dbContext.Database.EnsureDeleted();
            this.dbContext.Database.EnsureCreated();

            this.dbContext.Categories.Load();

            this.categoryBindingSource.DataSource = dbContext.Categories.Local.ToBindingList();
        }

Include stack traces

    WinRT.Runtime.dll!WinRT.ExceptionHelpers.ThrowExceptionForHR.__Throw|39_0(int hr)   Unknown
    WinRT.Runtime.dll!WinRT.ExceptionHelpers.ThrowExceptionForHR(int hr)    Unknown
>   Microsoft.Windows.SDK.NET.dll!ABI.Windows.Storage.IApplicationDataStaticsMethods.get_Current(WinRT.IObjectReference _obj) Line 22   C#
    Microsoft.Windows.SDK.NET.dll!Windows.Storage.ApplicationData.Current.get() Line 66 C#
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    System.Private.CoreLib.dll!System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(object obj, System.Reflection.BindingFlags invokeAttr)  Unknown
    Microsoft.Data.Sqlite.dll!Microsoft.Data.Sqlite.SqliteConnection.SqliteConnection() Line 696    C#
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    Microsoft.Data.Sqlite.dll!Microsoft.Data.Sqlite.SqliteConnection.SqliteConnection() Line 719    C#
    Microsoft.EntityFrameworkCore.Sqlite.dll!Microsoft.EntityFrameworkCore.Sqlite.Update.Internal.SqliteUpdateSqlGenerator.SqliteUpdateSqlGenerator(Microsoft.EntityFrameworkCore.Update.UpdateSqlGeneratorDependencies dependencies) Line 31   C#
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    System.Private.CoreLib.dll!System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(object obj, System.Span<object> copyOfArgs, System.Reflection.BindingFlags invokeAttr)  Unknown
    System.Private.CoreLib.dll!System.Reflection.MethodBaseInvoker.InvokeWithOneArg(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture)  Unknown
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 54 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 78  C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope scope) Line 28   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.RealizeService.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope scope) Line 24 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceIdentifier serviceIdentifier, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngineScope) Line 179 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(System.Type serviceType) Line 70  C#
    Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(System.IServiceProvider provider, System.Type serviceType)   Unknown
    Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<Microsoft.EntityFrameworkCore.ModelCreationDependencies>(System.IServiceProvider provider)   Unknown
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel(bool designTime) Line 70 C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.Internal.DbContextServices.Model.get() Line 116 C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.TryAddCoreServices.AnonymousMethod__8_4(System.IServiceProvider p) Line 285   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(Microsoft.Extensions.DependencyInjection.ServiceLookup.FactoryCallSite factoryCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 154    C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite constructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 51 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSiteMain(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 32   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngine, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverLock lockType) Line 113   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext context) Line 88 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, object>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext argument) Line 20   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope scope) Line 28   C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.RealizeService.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope scope) Line 24 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceIdentifier serviceIdentifier, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope serviceProviderEngineScope) Line 179 C#
    Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(System.Type serviceType) Line 70  C#
    Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(System.IServiceProvider provider, System.Type serviceType)   Unknown
    Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<Microsoft.EntityFrameworkCore.Internal.IDbContextDependencies>(System.IServiceProvider provider) Unknown
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.DbContext.DbContextDependencies.get() Line 468  C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.DbContext.ContextServices.get() Line 450    C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.DbContext.InternalServiceProvider.get() Line 404    C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.Instance.get() Line 2216    C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.Infrastructure.Internal.InfrastructureExtensions.GetService(Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider> accessor, System.Type serviceType) Line 34    C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.Infrastructure.Internal.InfrastructureExtensions.GetService<Microsoft.EntityFrameworkCore.Storage.IDatabaseFacadeDependencies>(Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider> accessor) Line 24  C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService<Microsoft.EntityFrameworkCore.Storage.IDatabaseFacadeDependencies>(Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider> accessor) Line 42 C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.Dependencies.get() Line 32    C#
    Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreated() Line 79   C#
    GetStartedWinForms.dll!GetStartedWinForms.MainForm.OnLoad(System.EventArgs e) Line 23   C#
    System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool ignoreVisible) Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl()   Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Control.WmShowWindow(ref System.Windows.Forms.Message m)  Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m)   Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m)   Unknown
    System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(Windows.Win32.Foundation.HWND hWnd, Windows.Win32.MessageId msg, Windows.Win32.Foundation.WPARAM wparam, Windows.Win32.Foundation.LPARAM lparam)    Unknown
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    System.Windows.Forms.Primitives.dll!Windows.Win32.PInvoke.ShowWindow<System.Windows.Forms.Control>(System.Windows.Forms.Control hWnd, Windows.Win32.UI.WindowsAndMessaging.SHOW_WINDOW_CMD nCmdShow)    Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Control.SetVisibleCore(bool value)    Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Form.SetVisibleCore(bool value)   Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Microsoft.Office.msoloop reason, System.Windows.Forms.ApplicationContext context)   Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Microsoft.Office.msoloop reason, System.Windows.Forms.ApplicationContext context)    Unknown
    GetStartedWinForms.dll!GetStartedWinForms.Program.Main() Line 14    C#

Include verbose output

'GetStartedWinForms.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Private.CoreLib.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\GetStartedWinForms.dll'. Symbols loaded.
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Runtime.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\hotreload\Microsoft.Extensions.DotNetDeltaApplier.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.IO.Pipes.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Linq.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Collections.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Console.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Threading.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Runtime.InteropServices.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Threading.Overlapped.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Security.AccessControl.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Security.Principal.Windows.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Security.Claims.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Runtime.Loader.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.6\System.Windows.Forms.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Collections.Concurrent.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.ComponentModel.Primitives.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.6\System.Windows.Forms.Primitives.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Drawing.Primitives.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Collections.Specialized.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.ComponentModel.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Diagnostics.TraceSource.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.6\System.Drawing.Common.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\Microsoft.Win32.Primitives.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.ComponentModel.EventBasedAsync.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Threading.Thread.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.6\Accessibility.dll'. Module was built without symbols.
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.ComponentModel.TypeConverter.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.6\ko\System.Windows.Forms.resources.dll'. Module was built without symbols.
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Numerics.Vectors.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.ObjectModel.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.EntityFrameworkCore.Abstractions.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.6\Microsoft.Win32.SystemEvents.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Memory.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Private.Uri.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.EntityFrameworkCore.dll'. Symbols loaded.
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Linq.Expressions.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Collections.NonGeneric.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Collections.Immutable.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Diagnostics.Tracing.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.DependencyInjection.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.Logging.Abstractions.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Diagnostics.DiagnosticSource.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.Caching.Abstractions.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Threading.ThreadPool.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Reflection.Emit.ILGeneration.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Reflection.Emit.Lightweight.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Reflection.Primitives.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'Anonymously Hosted DynamicMethods Assembly'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.EntityFrameworkCore.Sqlite.dll'. Symbols loaded.
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.EntityFrameworkCore.Relational.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Data.Common.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Transactions.Local.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.Logging.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.Options.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Text.Json.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.Configuration.Abstractions.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.Caching.Memory.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Extensions.Primitives.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Data.Sqlite.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\SQLitePCLRaw.core.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\netstandard.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\SQLitePCLRaw.batteries_v2.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\SQLitePCLRaw.provider.e_sqlite3.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\Microsoft.Windows.SDK.NET.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Users\H-\Downloads\EntityFramework.Docs-main\samples\core\WinForms\GetStartedWinForms\GetStartedWinForms\bin\Debug\net8.0-windows10.0.19041.0\WinRT.Runtime.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Runtime.CompilerServices.Unsafe.dll'. 
Exception thrown: 'System.InvalidOperationException' in WinRT.Runtime.dll
Operation is not valid due to the current state of the object.

The thread '[Thread Destroyed]' (2956) has exited with code 0 (0x0).
The thread '[Thread Destroyed]' (17244) has exited with code 0 (0x0).
The thread '[Thread Destroyed]' (11460) has exited with code 0 (0x0).
The thread '[Thread Destroyed]' (18128) has exited with code 0 (0x0).
Exception thrown: 'System.Reflection.TargetInvocationException' in System.Private.CoreLib.dll
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.ComponentModel.Annotations.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Net.Primitives.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Net.NetworkInformation.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Runtime.Intrinsics.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Text.RegularExpressions.dll'. 
'GetStartedWinForms.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.6\System.Linq.Queryable.dll'. 

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

cincuranet commented 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.

hypercode-go commented 4 months ago

Upload my repository see the link.

Test project

You can see output

Exception thrown: 'System.InvalidOperationException' in WinRT.Runtime.dll
Exception thrown: 'System.Reflection.TargetInvocationException' in System.Private.CoreLib.dll
cincuranet commented 4 months ago

I was able to run your application just fine: image

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.

hypercode-go commented 4 months ago

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.

cincuranet commented 4 months ago

I'm running it on Windows 11 (22631.3737) with net8.0-windows10.0.19041.0 (the version you provided in the repro).

hypercode-go commented 4 months ago

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.