SimpleIdServer icon indicating copy to clipboard operation
SimpleIdServer copied to clipboard

version6.0.5 bug

Open worldofchu opened this issue 5 months ago • 3 comments

I am using it directly from version 6.0.5, which is brand new。 use postgresql。 version6.0.5 ,First run ,the error is:

Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (66ms) [Parameters=[@__name_0='?'], CommandType='Text', CommandTimeout='30'] SELECT e."Id", e."ExecutionDateTime", e."Name" FROM "ExecutionHistories" AS e WHERE e."Name" = @__name_0 LIMIT 2 fail: Microsoft.EntityFrameworkCore.Query[10100] An exception occurred while iterating over the results of a query for context type 'SimpleIdServer.IdServer.Store.EF.StoreDbContext'. Npgsql.PostgresException (0x80004005): 42P01: 关系 "ExecutionHistories" 不存在

  POSITION: 54
     at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
     at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
     at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
     at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
     at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
     at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumera
	 
	 
	 
	 second run   the  error  is:
	 
	 fail: Microsoft.EntityFrameworkCore.Query[10100]
  An exception occurred while iterating over the results of a query for context type 'SimpleIdServer.IdServer.Store.EF.StoreDbContext'.
  System.InvalidCastException: Reading as 'System.String' is not supported for fields having DataTypeName 'integer'
     at Npgsql.Internal.AdoSerializerHelpers.<GetTypeInfoForReading>g__ThrowReadingNotSupported|0_0(Type type, PgSerializerOptions options, PgTypeId pgTypeId, Exception inner)
     at Npgsql.Internal.AdoSerializerHelpers.GetTypeInfoForReading(Type type, PgTypeId pgTypeId, PgSerializerOptions options)
     at Npgsql.BackendMessages.FieldDescription.<GetInfo>g__GetInfoSlow|50_0(Type type, ColumnInfo& lastColumnInfo)
     at Npgsql.BackendMessages.FieldDescription.GetInfo(Type type, ColumnInfo& lastColumnInfo)
     at Npgsql.NpgsqlDataReader.<GetInfo>g__Slow|133_0(ColumnInfo& info, PgConverter& converter, Size& bufferRequirement, Boolean& asObject, <>c__DisplayClass133_0&)
     at Npgsql.NpgsqlDataReader.GetFieldValueCore[T](Int32 ordinal)
     at Npgsql.NpgsqlDataReader.GetString(Int32 ordinal)
     at lambda_method88(Closure, DbDataReader, Int32[])
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadObject(DbDataReader reader, Int32 ordinal, ReaderColumn column)
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadRow()
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.InitializeAsync(DbDataReader reader, IReadOnlyList`1 columns, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList`1 columns, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList`1 columns, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.FromSqlQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
     at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.FromSqlQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
  System.InvalidCastException: Reading as 'System.String' is not supported for fields having DataTypeName 'integer'
     at Npgsql.Internal.AdoSerializerHelpers.<GetTypeInfoForReading>g__ThrowReadingNotSupported|0_0(Type type, PgSerializerOptions options, PgTypeId pgTypeId, Exception inner)
     at Npgsql.Internal.AdoSerializerHelpers.GetTypeInfoForReading(Type type, PgTypeId pgTypeId, PgSerializerOptions options)
     at Npgsql.BackendMessages.FieldDescription.<GetInfo>g__GetInfoSlow|50_0(Type type, ColumnInfo& lastColumnInfo)
     at Npgsql.BackendMessages.FieldDescription.GetInfo(Type type, ColumnInfo& lastColumnInfo)
     at Npgsql.NpgsqlDataReader.<GetInfo>g__Slow|133_0(ColumnInfo& info, PgConverter& converter, Size& bufferRequirement, Boolean& asObject, <>c__DisplayClass133_0&)
     at Npgsql.NpgsqlDataReader.GetFieldValueCore[T](Int32 ordinal)
     at Npgsql.NpgsqlDataReader.GetString(Int32 ordinal)
     at lambda_method88(Closure, DbDataReader, Int32[])
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadObject(DbDataReader reader, Int32 ordinal, ReaderColumn column)
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadRow()
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.InitializeAsync(DbDataReader reader, IReadOnlyList`1 columns, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList`1 columns, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList`1 columns, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.FromSqlQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
     at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
     at Microsoft.EntityFrameworkCore.Query.Internal.FromSqlQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()

fail: SimpleIdServer.IdServer.Store.EF.StoreDbContext[0] System.InvalidCastException: Reading as 'System.String' is not supported for fields having DataTypeName 'integer' at Npgsql.Internal.AdoSerializerHelpers.<GetTypeInfoForReading>g__ThrowReadingNotSupported|0_0(Type type, PgSerializerOptions options, PgTypeId pgTypeId, Exception inner) at Npgsql.Internal.AdoSerializerHelpers.GetTypeInfoForReading(Type type, PgTypeId pgTypeId, PgSerializerOptions options) at Npgsql.BackendMessages.FieldDescription.<GetInfo>g__GetInfoSlow|50_0(Type type, ColumnInfo& lastColumnInfo) at Npgsql.BackendMessages.FieldDescription.GetInfo(Type type, ColumnInfo& lastColumnInfo) at Npgsql.NpgsqlDataReader.<GetInfo>g__Slow|133_0(ColumnInfo& info, PgConverter& converter, Size& bufferRequirement, Boolean& asObject, <>c__DisplayClass133_0&) at Npgsql.NpgsqlDataReader.GetFieldValueCore[T](Int32 ordinal) at Npgsql.NpgsqlDataReader.GetString(Int32 ordinal) at lambda_method88(Closure, DbDataReader, Int32[]) at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadObject(DbDataReader reader, Int32 ordinal, ReaderColumn column) at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.ReadRow() at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.BufferedDataRecord.InitializeAsync(DbDataReader reader, IReadOnlyList1 columns, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList1 columns, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader.InitializeAsync(IReadOnlyList1 columns, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.FromSqlQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.FromSqlQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken) at DIP.SID.SIdServer.Conf.Migrations.BeforeDeployment.ClientTypeDataSeeder.Execute(CancellationToken cancellationToken) in D:\gitee\simpleid6\simpleid6\DIP\DIP.SID.SIdServer\Conf\Migrations\BeforeDeployment\ClientTypeDataSeeder.cs:line 41 warn: Microsoft.EntityFrameworkCore.Model[10605] There are multiple relationships between 'TemplateStyle' and 'Template' without configured foreign key properties. This will cause Entity Framework to create shadow properties on 'TemplateStyle' with names dependent on the discovery order. Consider configuring the foreign key properties using the [ForeignKey] attribute or in 'OnModelCreating'. warn: Microsoft.EntityFrameworkCore.Model.Validation[10625] The foreign key property 'TemplateStyle.TemplateId1' was created in shadow state because a conflicting property with the simple name 'TemplateId' exists in the entity type, but is either not mapped, is already used for another relationship, or is incompatible with the associated primary key type. See https://aka.ms/efcore-relationships for information on mapping relationships in EF Core.

worldofchu avatar Sep 04 '25 06:09 worldofchu

simpleid6\dataseeder\dataseeder\ServiceProviderExtensions.cs ,i comment two lines. public static class ServiceProviderExtensions { public static void SeedData(this IServiceProvider serviceProvider) { using (var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope()) { var dataMigrationService = scope.ServiceProvider.GetService<IDataMigrationService>(); //dataMigrationService.MigrateBeforeDeployment(CancellationToken.None).Wait(); dataMigrationService.Migrate(CancellationToken.None).Wait(); //dataMigrationService.MigrateAfterDeployment(CancellationToken.None).Wait(); } } }

but that's occur an error simpleid6\src\IdServer\SimpleIdServer.IdServer\WebApplicationExtensions.cs in line 715 languageCodes count is 0!!!!! if(!languageCodes.Contains(Language.Default)) { throw new InvalidOperationException($"The default language {Language.Default} is not present in the repository. Please add it"); }

worldofchu avatar Sep 04 '25 06:09 worldofchu

Do not comment out both lines "MigrateBeforeDeployment" and "Migrate". Instead, edit the file Conf/SidServerSetup.cs and comment out the following line:

builder.Services.AddTransient<IDataSeeder, ClientTypeDataSeeder>();

After this change, the following exception should no longer be thrown:

System.InvalidCastException: Reading as 'System.String' is not supported for fields having DataTypeName 'integer'


De : worldofchu @.> Envoyé : jeudi 4 septembre 2025 08:30 À : simpleidserver/SimpleIdServer @.> Cc : Subscribed @.***> Objet : Re: [simpleidserver/SimpleIdServer] version6.0.5 bug (Issue #921)

[https://avatars.githubusercontent.com/u/35909069?s=20&v=4]worldofchu left a comment (simpleidserver/SimpleIdServer#921)https://github.com/simpleidserver/SimpleIdServer/issues/921#issuecomment-3252123085

simpleid6\dataseeder\dataseeder\ServiceProviderExtensions.cs ,i comment two lines. public static class ServiceProviderExtensions { public static void SeedData(this IServiceProvider serviceProvider) { using (var scope = serviceProvider.GetRequiredService().CreateScope()) { var dataMigrationService = scope.ServiceProvider.GetService(); //dataMigrationService.MigrateBeforeDeployment(CancellationToken.None).Wait(); dataMigrationService.Migrate(CancellationToken.None).Wait(); //dataMigrationService.MigrateAfterDeployment(CancellationToken.None).Wait(); } } }

but that's occur an error simpleid6\src\IdServer\SimpleIdServer.IdServer\WebApplicationExtensions.cs in line 715 languageCodes count is 0!!!!! if(!languageCodes.Contains(Language.Default)) { throw new InvalidOperationException($"The default language {Language.Default} is not present in the repository. Please add it"); }

— Reply to this email directly, view it on GitHubhttps://github.com/simpleidserver/SimpleIdServer/issues/921#issuecomment-3252123085, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACXN2536TXGULPQEQIZQVJ33Q7L73AVCNFSM6AAAAACFS2KTI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENJSGEZDGMBYGU. You are receiving this because you are subscribed to this thread.Message ID: @.***>

thabart avatar Sep 04 '25 06:09 thabart

Thanks ok

worldofchu avatar Sep 09 '25 08:09 worldofchu