Just found why it was working on 4.0.0 and not 4.3.3, I simply forgot to setup the property "Copy to Output Directory" of the file as "Copy always".
About IConfiguration, I do not know, but no need to use it yet...
In version 4.0.0, I wanted to run DbMigrator
project with a different appsettings file depending if I was in dev, test or production. It is an angular solution
To make it work, I added a method BuildConfiguration
on the class DbMigratorHostedService
:
` private static IConfiguration BuildConfiguration() { var configurationBuilder = new ConfigurationBuilder();
var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
if (environmentName != null)
{
configurationBuilder.AddJsonFile($"appsettings.{environmentName}.json", true);
}
else
{
configurationBuilder.AddJsonFile("appsettings.json");
}
return configurationBuilder
.AddEnvironmentVariables()
.Build();
}
}`
It was called with options.Services.ReplaceConfiguration(BuildConfiguration());
into AbpApplicationFactory.Create
of StartAsync
method, it was working well.
Even after updating this solution to ABP 5.0.0, I still do not have this issue.
I afterwards created another solution, using Blazor this time, with version 4.3.3, but I then get this error on the console:
D:\AppAI\src\AppAI.DbMigrator\bin\Debug\net6.0\AppAI.DbMigrator.exe (process 139992) exited with code -42. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . .
I updated to ABP 5.0.0 as well, and I still get this issue.
Note: When creating a new solution with version 5.0.0, a DI is now used about IConfiguration options.Services.ReplaceConfiguration(_configuration);
I tried to add it on my solution, but I do not see on how to change configuration values, I see production settings, but it's empty, even if I have a appsettings production file.
Hi
I updated to v5.0.0-rc.2 and all seems working well now. I close the ticket then.
Thanks
ABP Framework version: v5.0.0-rc.1 UI type: Angular DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): no
Steps to reproduce the issue:
1- Create a new solution 2- Create an entity 3- Open Test explorer
When I right click on EntityFrameworkCore project and select run, all tests fails with the message
Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module AppRC.AppRCTestBaseModule, AppRC.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: Undefined feature: Identity.MaxUserCount0
---- Volo.Abp.AbpException : Undefined feature: Identity.MaxUserCount0
NOTE: This is not every times, but often enoug. It can happens when click on "Run All Tests in View" too. I met the issue now that "Run All Tests in View" do not run all tests anymore too, it skip projects... If run tests one by one, it works well.
I got the error when run on Microsoft DevOps pipeline too
---- Volo.Abp.AbpException : Undefined feature: Identity.MaxUser�
Good to know, thank for the update.
I will close the issue once I will have tried it then
If you're creating a bug/problem report, please include followings:
ABP Framework version: v4.4.3
UI type: Angular
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): no
Steps to reproduce the issue:"
If I generatean entity with a required navigation property I get errors when running unit tests
All unit tests fail and get the error Microsoft.Data.Sqlite.SqliteException : SQLite Error 19: 'FOREIGN KEY constraint failed'.
I fixed the issue by adding the required field on my entity test files, but anytime I regenerate my entity I need to fix it again in both test files MyEntitySetAppServiceTests.cs
and MyEntitySetDataSeedContributor.cs
by adding a value for this required navigation property.
Will it be possible to fix the test generation to add it automatically? Because of this issue, I do not put navigation property required in any of my entities (even if they should), as it will need too much extra work anytimes we regenerate entities. Otherwise, is there any other way to make it works without having to change it after each generation?
Thanks
I moved my IDataSeedContributor
class to DbMigrator
project and it's much better.
Now I do not have to move my AppPermissions
class from project Application.Contract
to Domain.Shared
anymore, so I do not have any issues about adding references as DbMigrator
already reference Application.Contracts
by default.
I close the issue then, thanks for your help
Thanks for your answer, it was helpfull even I did a bit differently. I take the value from JavaScript on "local", means the value I selected with my DateTimePicker:
startDateTimeString = this.startDateTime.getFullYear() + String(1 + this.startDateTime.getMonth()).padStart(2,"0") + String(this.startDateTime.getDate()).padStart(2,"0") + String(this.startDateTime.getHours()).padStart(2,"0") + String(this.startDateTime.getMinutes()).padStart(2,"0");
I then send this string '202110061930' to my back-end and create a new DateTime:
var startDateTimeLocal = new DateTime(Convert.ToInt32(input.StartDateTimeString.Substring(0, 4)), Convert.ToInt32(input.StartDateTimeString.Substring(4, 2)), Convert.ToInt32(input.StartDateTimeString.Substring(6, 2)), Convert.ToInt32(input.StartDateTimeString.Substring(8, 2)), Convert.ToInt32(input.StartDateTimeString.Substring(10, 2)), 0, DateTimeKind.Unspecified);
I then convert it in Utc based on a TimeZone defined on the same entity which have this DateTime and send it to the database in Utc.
For that I used NodaTime instead of using the TimeZone of DotNet Framework.
Now all is working well :)