Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run out of Memory Error #2247

Closed
lijunjiang-amentum opened this issue Mar 28, 2024 · 3 comments
Closed

Run out of Memory Error #2247

lijunjiang-amentum opened this issue Mar 28, 2024 · 3 comments
Labels
bug Something isn't working reveng reveng-cli

Comments

@lijunjiang-amentum
Copy link

When I tried to generated 400 entities through the tool in Visual Studio 2022 (17.8.2), It uses all my computer memory. My computer has 32 GB memory. The process take a long time and eventually get "Run out of memory error".

It works fine with previous version. I don't remember the version no, this issue occurs after I upgrade tool to 2.6.200

Here is the exception:

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Collections.Generic.Queue1.SetCapacity(Int32 capacity) at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.GetConversion(Boolean throwOnValueConverterConflict, Boolean throwOnProviderClrTypeConflict) at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.GetValueConverter() at Microsoft.EntityFrameworkCore.Storage.TypeMappingInfo..ctor(IReadOnlyList1 principals, Nullable1 fallbackUnicode, Nullable1 fallbackSize, Nullable1 fallbackPrecision, Nullable1 fallbackScale)
at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingInfo..ctor(IReadOnlyList1 principals, String storeTypeName, String storeTypeNameBase, Nullable1 fallbackUnicode, Nullable1 fallbackFixedLength, Nullable1 fallbackSize, Nullable1 fallbackPrecision, Nullable1 fallbackScale)
at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMapping(IProperty property)
at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.<>c.<get_TypeMapping>b__93_0(IProperty property)
at Microsoft.EntityFrameworkCore.Internal.NonCapturingLazyInitializer.EnsureInitialized[TParam,TValue](TValue& target, TParam param, Func2 valueFactory) at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.get_TypeMapping() at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty.FindTypeMapping() at Microsoft.EntityFrameworkCore.RelationalPropertyExtensions.FindRelationalTypeMapping(IReadOnlyProperty property) at Microsoft.EntityFrameworkCore.RelationalPropertyExtensions.GetColumnType(IReadOnlyProperty property) at Microsoft.EntityFrameworkCore.RelationalPropertyExtensions.GetColumnType(IProperty property) at Microsoft.EntityFrameworkCore.Metadata.Internal.RelationalModel.AddDefaultMappings(RelationalModel databaseModel, IEntityType entityType, IRelationalTypeMappingSource relationalTypeMappingSource) at Microsoft.EntityFrameworkCore.Metadata.Internal.RelationalModel.Create(IModel model, IRelationalAnnotationProvider relationalAnnotationProvider, IRelationalTypeMappingSource relationalTypeMappingSource, Boolean designTime) at Microsoft.EntityFrameworkCore.Metadata.Internal.RelationalModel.Add(IModel model, IRelationalAnnotationProvider relationalAnnotationProvider, IRelationalTypeMappingSource relationalTypeMappingSource, Boolean designTime) at Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelRuntimeInitializer.InitializeModel(IModel model, Boolean designTime, Boolean prevalidation) at Microsoft.EntityFrameworkCore.Infrastructure.ModelRuntimeInitializer.Initialize(IModel model, Boolean designTime, IDiagnosticsLogger1 validationLogger)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(DatabaseModel databaseModel, ModelReverseEngineerOptions options)
at RevEng.Core.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions, Boolean removeNullableBoolDefaults, Boolean excludeNavigations, Boolean dbContextOnly, Boolean entitiesOnly, Boolean useSchemaFolders, Boolean useSchemaNamespaces) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerScaffolder.cs:line 488
at RevEng.Core.ReverseEngineerScaffolder.GenerateDbContext(ReverseEngineerCommandOptions options, List`1 schemas, String outputContextDir, String modelNamespace, String contextNamespace, String projectPath, String outputPath) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerScaffolder.cs:line 94
at RevEng.Core.ReverseEngineerRunner.GenerateFiles(ReverseEngineerCommandOptions options) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerRunner.cs:line 86

Provide technical details

  • EF Core Power Tools version: 2.6.140 and 2.6.200

  • Exact Visual Studio version: (e.g. Visual Studio 2022 17.8.2)

  • Database engine: SQL Server 2016

  • EF Core version in use: EF Core 8

  • Is Handlebars templates used: no

  • Is T4 templates used: no. Same error when use T4 template too.

  • Is a SQL Server .dacpac used: no

@ErikEJ
Copy link
Owner

ErikEJ commented Mar 29, 2024

Regression in EF Core 8.0.3: dotnet/efcore#33176

@ErikEJ ErikEJ closed this as completed in cbd6deb Mar 29, 2024
@ErikEJ
Copy link
Owner

ErikEJ commented Mar 29, 2024

I implemented a fix for this in the latest daily build, would be grateful if you could try it out.

@lijunjiang-amentum
Copy link
Author

The build fixed it.

Thanks

@ErikEJ ErikEJ added bug Something isn't working reveng reveng-cli labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reveng reveng-cli
Projects
None yet
Development

No branches or pull requests

2 participants