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

Unable to generate the model - Parameter name: size #2179

Open
mbob001 opened this Issue Oct 3, 2018 · 15 comments

Comments

Projects
None yet
4 participants
@mbob001

mbob001 commented Oct 3, 2018

Steps to reproduce
Update model from database. Refresh tables.

The issue

I excepted updated model, but I get an error:

Unable to generate the model because of the following exception:

System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> Npgsql.NpgsqlException: Exception while writing to stream ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: size
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at Npgsql.NpgsqlWriteBuffer.<Flush>d__26.MoveNext()
   --- End of inner exception stack trace ---
   at Npgsql.NpgsqlWriteBuffer.<Flush>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlWriteBuffer.<>c__DisplayClass54_0.<<WriteString>g__WriteStringLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Npgsql.FrontendMessages.BindMessage.<Write>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlCommand.<SendExecute>d__84.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlCommand.<ExecuteDbDataReader>d__100.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
   at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   --- End of inner exception stack trace ---
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.Execute(EntityCommand entityCommand, CommandBehavior behavior)
   at System.Data.Entity.Core.EntityClient.EntityCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadDataTable[T](String sql, Func`2 orderByFunc, DataTable table, EntityStoreSchemaFilterObjectTypes queryTypes, IEnumerable`1 filters, String[] filterAliases)
   at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadTableDetails(IEnumerable`1 filters)
   at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadStoreSchemaDetails(IList`1 filters)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GetStoreSchemaDetails(StoreSchemaConnectionFactory connectionFactory)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(List`1 errors)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModels(String storeModelNamespace, ModelBuilderSettings settings, List`1 errors)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings settings, IVsUtils vsUtils, ModelBuilderEngineHostContext hostContext)'.
Loading metadata from the database took 00:00:01.9430516.
Generating the model took 00:00:03.1164617.

Further technical details

Npgsql version: 4.0.3
PostgreSQL version: 9.4
Operating system: DB is on Debian Linux, NPGSQL in Windows 10, Visual Studio 2017

I added 5 columns to one table, after that, cannot update model. Table has 234 columns, here is last added columns:
"ForkliftForkLoad" numeric(10,2),
"ForkliftForkLoadCAN" numeric(10,2),
"BatteryStatus" integer,
"ImpactIntensity" numeric(10,2),
"ImpactLevel" integer,

@YohDeadfall

This comment has been minimized.

Member

YohDeadfall commented Oct 3, 2018

Are you using composite types?

@mbob001

This comment has been minimized.

mbob001 commented Oct 3, 2018

I am not sure. If you mean this: https://www.postgresql.org/docs/10/static/rowtypes.html - No i am not using. Or can you give me an example what you mean?

@YohDeadfall

This comment has been minimized.

Member

YohDeadfall commented Oct 3, 2018

I'm talking about that. If it's not your case, could you provide a minimal repro?

@mbob001

This comment has been minimized.

mbob001 commented Oct 3, 2018

Did you mean edmx model?

@npgsql npgsql deleted a comment from mbob001 Oct 3, 2018

@YohDeadfall

This comment has been minimized.

Member

YohDeadfall commented Oct 3, 2018

A small console application which triggers the specified error. Without it it's near to impossible to understand the exception reason.

@mbob001

This comment has been minimized.

mbob001 commented Oct 3, 2018

It's happen by update model, see short video:
https://develop.gxinnovation.eu/error_npgsql.webm
It's happen on any table, sometimes model is updated sometimes not updated.
Could be a problem on network, e.g. on router?

@austindrenski

This comment has been minimized.

Member

austindrenski commented Oct 3, 2018

@mbob001 As @YohDeadfall said, this issue will be exceedingly challenging to debug without a minimal reproduction of the issue in the form of a GitHub repo that we can clone and debug locally.

Are you able to put something like that together?

@mbob001

This comment has been minimized.

mbob001 commented Oct 4, 2018

I will try it.

@mbob001

This comment has been minimized.

mbob001 commented Oct 4, 2018

Here is test app with model. In folder "pgdump" is schema. If we update model from local DB then it's working. If we update from remote server (linux, see top) we get an error.
https://develop.gxinnovation.eu/TestDB.zip
Thanks.

@mbob001

This comment has been minimized.

mbob001 commented Oct 4, 2018

Here is error message from DEBUG VSIX project.
error

@mbob001

This comment has been minimized.

mbob001 commented Oct 4, 2018

I found maybe problem. In our database are almost 274 tables. If I deleted a few tables, model was updated. Is there a limit for count tables?

@YohDeadfall

This comment has been minimized.

Member

YohDeadfall commented Oct 7, 2018

No, there is no limit. It looks like an internal driver bug.

@mbob001

This comment has been minimized.

mbob001 commented Oct 8, 2018

And will be fixed?

@YohDeadfall

This comment has been minimized.

Member

YohDeadfall commented Oct 8, 2018

Sure, it will.

@YohDeadfall YohDeadfall added the bug label Oct 8, 2018

@YohDeadfall YohDeadfall self-assigned this Oct 8, 2018

@YohDeadfall YohDeadfall added this to the 4.0.4 milestone Oct 8, 2018

@roji

This comment has been minimized.

Member

roji commented Dec 4, 2018

@YohDeadfall have you had any success reproducing this? Any chance you'll have time to look at this for 4.0.4 or should we punt?

@YohDeadfall YohDeadfall modified the milestones: 4.0.4, 4.0.5 Dec 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment