I'm trying to run domain and application and have several sub modules which EFCore context's which use a different database entirely than base/primary app. The app runs fine and DBMigrator runs fine but when I run tests the data seeding fails. It looks like this has something to do with an "untracked" entitiy but I'm unable to track down where the issue may be coming from. Any suggestions?
If you're creating a bug/problem report, please include followings:
ABP Framework version: v7.0.3
UI type: Blazor-Server
DB provider: EF Core
Exception message and stack trace:
Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module GcIprs.Main.MainTestBaseModule, GcIprs.Main.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: An error occurred while saving the entity changes. See the inner exception for details.. See the inner exception for details. ---- Microsoft.EntityFrameworkCore.DbUpdateException : An error occurred while saving the entity changes. See the inner exception for details. -------- Microsoft.Data.Sqlite.SqliteException : SQLite Error 19: 'UNIQUE constraint failed: AbpLanguages.CultureName'.
Stack Trace:
ModuleManager.InitializeModules(ApplicationInitializationContext context)
AbpApplicationBase.InitializeModules()
AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
AbpIntegratedTest1.ctor() MainTestBase
1.ctor()
MainEntityFrameworkCoreTestBase.ctor()
SampleRepositoryTests.ctor() line 18
RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
----- Inner Stack Trace -----
ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) BatchExecutor.ExecuteAsync(IEnumerable
1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) StateManager.SaveChangesAsync(IList
1 entriesToSave, CancellationToken cancellationToken)
StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
AbpDbContext1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) UnitOfWork.SaveChangesAsync(CancellationToken cancellationToken) UnitOfWork.CompleteAsync(CancellationToken cancellationToken) UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) CastleAsyncAbpInterceptorAdapter
1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) <<SeedTestData>b__0>d.MoveNext() line 41 --- End of stack trace from previous location --- TaskExtensions.WaitAndUnwrapException(Task task) <>c__DisplayClass15_0.<Run>b__0(Task t) ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- TaskExtensions.WaitAndUnwrapException(Task task) AsyncContext.Run(Func
1 action)
AsyncHelper.RunSync(Func`1 action)
MainTestBaseModule.SeedTestData(ApplicationInitializationContext context) line 37
MainTestBaseModule.OnApplicationInitialization(ApplicationInitializationContext context) line 32
OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
ModuleManager.InitializeModules(ApplicationInitializationContext context)
----- Inner Stack Trace -----
SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
SqliteDataReader.NextResult()
SqliteCommand.ExecuteReader(CommandBehavior behavior)
SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
Steps to reproduce the issue:"
After upgrade I receive the error message:
AbpException: Could not find the bundle file '/libs/flag-icon-css/css/flag-icons.min.css' for the bundle 'Blazor.LeptonXTheme.Global'! Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpTagHelperResourceService.ProcessAsync(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, List<BundleTagHelperItem> bundleItems, string bundleName) Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpBundleTagHelperService<TTagHelper, TService>.ProcessAsync(TagHelperContext context, TagHelperOutput output) Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, int i, int count) GcIprs.Main.Blazor.Pages.Pages__Host.<ExecuteAsync>b__16_0() in _Host.cshtml + <abp-style-bundle name="@BlazorLeptonXThemeBundles.Styles.Global" /> Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync() GcIprs.Main.Blazor.Pages.Pages__Host.ExecuteAsync() in _Host.cshtml + <html lang="@CultureInfo.CurrentCulture.Name" dir="@rtl"> Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context) Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts) Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
doing "yarn add flag-icons" and changing abp.resourcemapping.js to the following and running abp install-libs fixes it but why is this needed?
module.exports = { aliases: { "@node_modules": "./node_modules", "@libs": "./wwwroot/libs" }, clean: [ "@libs", "!@libs/**/foo.txt" ], mappings: { "@node_modules/flag-icon-css/css/*.min.css": "@libs/flag-icon-css/css/", } };
This is how my package.json looks after running abp update and install-libs still receiving the error (without my fix):
{ "version": "1.0.0", "name": "my-app", "private": true, "dependencies": { "@volo/abp.aspnetcore.mvc.ui.theme.leptonx": "~2.1.0", "@volo/account": "^7.1.1", "@volo/aspnetcore.components.server.leptonxtheme": "~2.1.0", "@volo/cms-kit-pro.admin": "^7.1.1", "@volo/language-management": "^7.1.1", //"flag-icons": "^6.6.6" } }
running abp update this morning gives the following but still doesn't solve the problem:
{ "version": "1.0.0", "name": "my-app", "private": true, "dependencies": { "@volo/abp.aspnetcore.mvc.ui.theme.leptonx": "~2.1.0", "@volo/account": "~7.2.0", "@volo/aspnetcore.components.server.leptonxtheme": "~2.1.0", "@volo/cms-kit-pro.admin": "~7.2.0", "@volo/language-management": "~7.2.0" } }
Using the CMS menus I created several CMS artifacts including a page and menu and nothing seems to be working! The url-slugs don't work and the menus don't show. The Global Features are activated and I tested whether any migrations were needed but they weren't.
It looks like your assuming we're using the public website. I'll try adding the public modules to the admin site and see if that works.
Adding [DependsOn(typeof(CmsKitProPublicWebModule))] to the MainBlazorModule obtained what I was looking for.
It looks like there is a bug in "abp new" for 8.1.1 with the basic theme
Run the following: abp new TestMe.MainApp -u blazor-server -csf --version 8.1.1 --theme basic -t app-pro
Gives These Errors:
C:\Users\xxxxxx\source\repos_build\TestMe.MainApp\src\TestMe.MainApp.Blazor\Pages_Host.cshtml(4,42): error CS0234: T he type or namespace name 'Basic' does not exist in the namespace 'Volo.Abp.AspNetCore.Components.Web' (are you missing an assembly reference?) [C:\Users\xxxxxx\source\repos_build\TestMe.MainApp\src\TestMe.MainApp.Blazor\TestMe.MainApp. Blazor.csproj] C:\Users\xxxxxx\source\repos_build\TestMe.MainApp\src\TestMe.MainApp.Blazor\MainAppBlazorModule.cs(70,12): error CS02 46: The type or namespace name 'AbpAspNetCoreMvcUiBasicThemeModule' could not be found (are you missing a using directi ve or an assembly reference?) [C:\Users\xxxxxx\source\repos_build\TestMe.MainApp\src\TestMe.MainApp.Blazor\TestMe.Mai nApp.Blazor.csproj] 0 Warning(s) 2 Error(s)
The template also seems to be using <HeadOutlet> when it should be using this in order to support the MVC pages such as the login page, right?
<component type="typeof(HeadOutlet)" render-mode="Server" />
There seems to be an issue with the logic in modules\account\src\Volo.Abp.Account.Web\Pages\Account\Register.cshtml.cs
On line 71 I see IsExternalLoginOnly but there seems to be NO way to get to this! The function CheckSelfRegistrationAsync returns TRUE if ANY external login exists (line 206) which would obviously make it empossible for line 71 to EVER run and thus for OnPostExternalLogin to ever run. Am I missing something? I disabled both Abp.Account.EnableLocalLogin and Abp.Account.IsSelfRegistrationEnabled but then was surprised to still see a registration screen. What am I missing? I see your response to https://support.abp.io/QA/Questions/6843/External-Provider-login-is-able-to-register-a-user-even-if-self-register-setting-is-disabled but I still think there might be a bug here? Shouldn't line 71 be able to run somehow? Shouldn't there just be a standard place to autoregister a user.
This used to be done easily by a function CreateExternalUserAsync(ExternalLoginInfo info) on LoginModel but that seemed to go away. What is the replacement to that function?
Also, previously I had made the decision to use email address for username for all users but I see this is NOT the default approach ABP takes. Is there a "standard" way to change this? Is overriding UserManager.GetUserNameFromEmailAsync() to just return the email address a bad idea?
Thanks,
Jonathan