title: System.AccessViolationException in Entity Framework Core Add-Migration
body: <p>I get a &quot;System.AccessViolationException&quot; when trying to create a migration with Entity Framework Core.</p>
  <p>I already tested inside Visual Studio Package Manager Console and from PowerShell using CLI, both result in the same error.</p>
  <p>Here is the CLI example and the result:</p>
  <pre><code>PS dotnet ef migrations add [migration-name] --project [project-name] --startup-project [project-name]
  Build started...
  Build succeeded.
  </code></pre>
  <blockquote>
  <p>Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</p>
  <p>at System.Diagnostics.StackTrace.GetStackFramesInternal(System.Diagnostics.StackFrameHelper, Int32, Boolean, System.Exception)<br />
  at System.Diagnostics.StackFrameHelper.InitializeSourceInfo(Int32, Boolean, System.Exception)<br />
  at System.Diagnostics.StackTrace.CaptureStackTrace(Int32, Boolean, System.Exception)<br />
  at System.Diagnostics.StackTrace..ctor(System.Exception, Boolean)<br />
  at System.Exception.get_StackTrace()<br />
  at System.Exception.ToString()<br />
  at System.Exception.ToString()<br />
  at Microsoft.EntityFrameworkCore.Design.OperationExecutor+OperationBase.Execute(System.Action)<br />
  at Microsoft.EntityFrameworkCore.Design.OperationExecutor+OperationBase.Execute[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]<br />
  at Microsoft.EntityFrameworkCore.Design.OperationExecutor+AddMigration..ctor(Microsoft.EntityFrameworkCore.Design.OperationExecutor, Microsoft.EntityFrameworkCore.Design.IOperationResultHandler, System.Collections.IDictionary)<br />
  at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean, Boolean)<br />
  at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)<br />
  at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)<br />
  at System.Activator.CreateInstance(System.Type, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])<br />
  at System.Activator.CreateInstance(System.Type, System.Object[])<br />
  at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor.Execute(System.String, System.Object, System.Collections.IDictionary)<br />
  at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Runtime.CompilerServices.CallSite, System.__Canon, System.__Canon, System.__Canon, System.__Canon)<br />
  at Microsoft.EntityFrameworkCore.Tools.OperationExecutorBase.InvokeOperationImpl(System.String, System.Collections.IDictionary)<br />
  at Microsoft.EntityFrameworkCore.Tools.OperationExecutorBase.InvokeOperation[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.String, System.Collections.IDictionary)<br />
  at Microsoft.EntityFrameworkCore.Tools.OperationExecutorBase.AddMigration(System.String, System.String, System.String)<br />
  at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute()<br />
  at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase+&lt;&gt;c__DisplayClass0_0.b__0()<br />
  at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(System.String[])<br />
  at Microsoft.EntityFrameworkCore.Tools.Program.Main(System.String[])</p>
  </blockquote>
  <p>I've also tried things like restarting the PC and Windows Memory Diagnostic tests, but nothing.</p>
  <p>Guess it's important to say that I was successfully creating migrations a couple days ago, but this specifically migration is not working. And also the migration is quite simple: just a new property on a class (new column on a table).</p>
  <p>Do anyone got any clue about what is happening?</p>