ABP Framework version: v4.4.4
UI type: Angular
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): yes
Exception message and stack trace:
Steps to reproduce the issue:"
I created a new solution with seperate IdentityServer via following cli command:
abp new Acme.BookStore --separate-identity-server -csf -dbms PostgreSql -u angular -m none -t app-pro -v 4.4.4
I changed connection strings
Host=localhost;Port=5432;Database=BookStoreDb;User ID=postgres;Password=1234;
Host=localhost;Port=5432;Database=IdentityServerDb;User ID=postgres;Password=1234;
I executed dotnet run
in .DbMigrator folder.
All tables created in BookStoreDb
but nothing happened in IdentityServerDb
. How can I create seperate IdentityServer Database ?
SELECT a."Id", a."ConcurrencyStamp", a."CreationTime", a."ExtraProperties", a."IsAbandoned", a."JobArgs", a."JobName", a."LastTryTime", a."NextTryTime", a."Priority", a."TryCount"
FROM "AbpBackgroundJobs" AS a
WHERE NOT (a."IsAbandoned") AND (a."NextTryTime" <= @__now_0)
ORDER BY a."Priority" DESC, a."TryCount", a."NextTryTime"
LIMIT @__p_1
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.2\System.Reflection.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
[14:27:52 ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Abp.BackgroundJobs.EntityFrameworkCore.BackgroundJobsDbContext'.
System.InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.
at Npgsql.Internal.TypeHandlers.DateTimeHandlers.TimestampTzHandler.ValidateAndGetLength(DateTime value, NpgsqlParameter parameter)
at Npgsql.Internal.TypeHandlers.DateTimeHandlers.TimestampTzHandler.ValidateObjectAndGetLength(Object value, NpgsqlLengthCache& lengthCache, NpgsqlParameter parameter)
at Npgsql.NpgsqlParameter.ValidateAndGetLength()
at Npgsql.NpgsqlParameterCollection.ValidateAndBind(ConnectorTypeMapper typeMapper)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, 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.AsyncEnumerator.MoveNextAsync()
System.InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.
at Npgsql.Internal.TypeHandlers.DateTimeHandlers.TimestampTzHandler.ValidateAndGetLength(DateTime value, NpgsqlParameter parameter)
at Npgsql.Internal.TypeHandlers.DateTimeHandlers.TimestampTzHandler.ValidateObjectAndGetLength(Object value, NpgsqlLengthCache& lengthCache, NpgsqlParameter parameter)
at Npgsql.NpgsqlParameter.ValidateAndGetLength()
at Npgsql.NpgsqlParameterCollection.ValidateAndBind(ConnectorTypeMapper typeMapper)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, 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.AsyncEnumerator.MoveNextAsync()
Steps to reproduce the issue:"
I create a new solution via Abp Suite (Postgres)
Add Migration (Initial)
Run solution
I get above error in logs.txt
Note:
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
Link User paging is not working ? I cannot see second page on users altough I switch the second page. Although it should show last seven records on second page , it still shows first 10 records. Also in Turkish link users page comes with two meaningless scrolls.
Note:I think it is a bug , so I have written same issue in bugs&issues but I didn't get any answer from support about it.
I created entities with Abp Suite. I am trying to post entity with postman. But I got above error although name
has value in json. If I remove [Required]
exception losts.
public class ServiceBalanceChangeReasonCreateDto
{
[Required]
public string Name { get; set; }
}
public virtual async Task<ServiceBalanceChangeReasonDto> CreateAsync(ServiceBalanceChangeReasonCreateDto input)
{
...
...
}
EDIT : This error occurs on all Required usages in CreateOrUpdate..Dtos (all AppService methods) we got this error in all enviroments(debug,stage and prod)
public void RemoveEmptyStrings()
{
// Look for changes
this.ChangeTracker.DetectChanges();
// Loop through each entity
foreach (var entity in this.ChangeTracker.Entries())
{
// Use reflection to find editable string properties
var properties = from p in entity.Entity.GetType().GetProperties()
where p.PropertyType == typeof(string)
&& p.CanRead
&& p.CanWrite
select p;
// Loop through each property and replace empty strings with null
foreach (var property in properties)
{
if (string.IsNullOrWhiteSpace(property.GetValue(entity.Entity, null) as string))
property.SetValue(entity.Entity, null, null);
}
}
}