When I try to add a migration file through PM I get an out of memory exception. Anyone else had this problem before and happen to know how to fix it? So far I have tried re installing VS 2013 to no avail
Monitoring my memory usage I have 12GB available, and it is using less than 8 while the add migration is running, so should be plenty available. Below is the output
PM> add-migration test
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) at System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(String migrationName, String language, String rootNamespace, Boolean ignoreChanges) at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges) at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) Exception of type 'System.OutOfMemoryException' was thrown.
To avoid this exception while working with StringBuilder, we can call the constructor StringBuilder. StringBuilder(Int32, Int32) and can set the MaxCapacity property to a value that will be large enough to serve the accommodation required when we expand the corresponding StringBuilder object.
When data structures or data sets that reside in memory become so large that the common language runtime is unable to allocate enough contiguous memory for them, an OutOfMemoryException exception results.
Simply restarting Visual Studio worked for me in this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With