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.66k stars 3.16k forks source link

Remove-Migration PMC Gives Error #10869

Closed stap123 closed 1 year ago

stap123 commented 6 years ago

Hi guys

Just to be clear this isn't stopping anything functioning I just thought you might like to know about it.

Every time I remove a migration from a project using the Remove-Migration command I then get a null reference exception shown in PMC. I've included below the content that I get outputted to the PMC for your information. (It looks like it doesn't output the whole message either as it ends with a comma)

The operation performs as expected but I get this exception every time afterwards and thought you might want to stop that happening (presuming it's not the intended result).

Remove-Migration
Removing migration '20180204102304_SFA-AddedCreateApplicationTask'.
Reverting model snapshot.
Done.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.EntityFrameworkCore.Tools.Json.Escape(String text)
   at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsRemoveCommand.ReportJsonResults(IDictionary result)
   at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsRemoveCommand.Execute()
   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.
{
  "migrationFile": "C:\\Users\\adams\\Source\\Repos\\AIM MVC\\Phinite.AIM\\Phinite.AIM.Domain.Complete\\Migrations\\20180204102304_SFA-AddedCreateApplicationTask.cs",
  "metadataFile": "C:\\Users\\adams\\Source\\Repos\\AIM MVC\\Phinite.AIM\\Phinite.AIM.Domain.Complete\\Migrations\\20180204102304_SFA-AddedCreateApplicationTask.Designer.cs",

Further technical details

EF Core version: 2.0.0 Database Provider: Microsoft.EntityFrameworkCore.SqlServer Operating system: Windows IDE: Visual Studio 2017 15.5.6

smitpatel commented 6 years ago

Duplicate of #9280 Fix is available in 2.0.1 version of EF Core.

stap123 commented 6 years ago

Thanks @smitpatel I had a quick look but didn't see that, my bad