Bug description
Hi,
Whenever I run the optimize command on a scaffolded model I get the error:
dotnet ef dbcontext optimize -o Models --no-build
Successfully generated a compiled model, to use it call 'options.UseModel(NBWebSeed1ContextModel.Instance)'. Run this command again when the model is modified.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.EntityFrameworkCore.Tools.Commands.DbContextOptimizeCommand.ReportResults(IEnumerable`1 generatedFiles)
at Microsoft.EntityFrameworkCore.Tools.Commands.DbContextOptimizeCommand.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.b__0(String[] args)
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Object reference not set to an instance of an object.
Your code
dotnet ef dbcontext optimize -o Models --no-build
My tool version is 9.0.7 but I'm running the command against a model that targets .NET 8 and depends on Microsoft.EntityFrameworkCore.SqlServer 8.0.15
Stack traces
Verbose output
EF Core version
9.0.7
Database provider
Microsoft.EntityFrameworkCore.SqlServer
Target framework
.NET 8.0
Operating system
Windows 10
IDE
Visual Studio 17.4.9
Bug description
Hi,
Whenever I run the optimize command on a scaffolded model I get the error:
dotnet ef dbcontext optimize -o Models --no-build
Successfully generated a compiled model, to use it call 'options.UseModel(NBWebSeed1ContextModel.Instance)'. Run this command again when the model is modified.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.EntityFrameworkCore.Tools.Commands.DbContextOptimizeCommand.ReportResults(IEnumerable`1 generatedFiles)
at Microsoft.EntityFrameworkCore.Tools.Commands.DbContextOptimizeCommand.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.b__0(String[] args)
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Object reference not set to an instance of an object.
Your code
Stack traces
Verbose output
EF Core version
9.0.7
Database provider
Microsoft.EntityFrameworkCore.SqlServer
Target framework
.NET 8.0
Operating system
Windows 10
IDE
Visual Studio 17.4.9