Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EF add-migration throwing System.OutOfMemoryException

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.

like image 244
rhunter Avatar asked Dec 29 '15 14:12

rhunter


People also ask

How do you avoid OutOfMemoryException?

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.

What is System OutOfMemoryException?

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.


1 Answers

Simply restarting Visual Studio worked for me in this case.

like image 152
Ciaran Gallagher Avatar answered Oct 02 '22 15:10

Ciaran Gallagher