Sebazzz/financial-app

Exception when trying to add admin user

kbalint opened this issue · 5 comments

Hi, I've set up the development version, so manually built the project, the database has been created, but at step 5, there's an exception, when trying to save the new user:

App.Support.Setup.SetupStepFailureException: Set-up stap 'Administrator maken' kan niet worden uitgevoerd. ---> System.InvalidOperationException: The entity of type 'AppUser' is sharing the table 'AspNetUsers' with entities of type 'AppUserPreferences', but there is no entity of this type with the same key value that has been marked as 'Added'. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the key values.
at Microsoft.EntityFrameworkCore.Update.Internal.CommandBatchPreparer.Validate(Dictionary2 sharedTablesCommandsMap) at Microsoft.EntityFrameworkCore.Update.Internal.CommandBatchPreparer.CreateModificationCommands(IReadOnlyList1 entries, Func1 generateParameterName) at Microsoft.EntityFrameworkCore.Update.Internal.CommandBatchPreparer.BatchCommands(IReadOnlyList1 entries)+MoveNext()
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple2 parameters, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore9.CreateAsync(TUser user, CancellationToken cancellationToken) at Microsoft.AspNetCore.Identity.UserManager1.CreateAsync(TUser user)
at Microsoft.AspNetCore.Identity.UserManager`1.CreateAsync(TUser user, String password)
at App.Support.Setup.Steps.AdminUserSetupStep.ExecuteCore(SetupUserModel data) in D:\Demos\financial-app\src\App\Support\Setup\Steps\AdminUserSetupStep.cs:line 41
at App.Support.Setup.Steps.TransactedSetupStep.Execute(Object data) in D:\Demos\financial-app\src\App\Support\Setup\Steps\TransactedSetupStep.cs:line 17
at App.Support.Setup.SetupService.ExecuteStep(SetupStepInvocation invocation, ObjectValidationCallback validationCallback) in D:\Demos\financial-app\src\App\Support\Setup\SetupService.cs:line 90
--- End of inner exception stack trace ---
at App.Support.Setup.SetupService.ExecuteStep(SetupStepInvocation invocation, ObjectValidationCallback validationCallback) in D:\Demos\financial-app\src\App\Support\Setup\SetupService.cs:line 101
at App.Api.SetupController.Execute(SetupStepInvocation invocation) in D:\Demos\financial-app\src\App\Api\SetupController.cs:line 36

Any thoughts on this, how to continue? Thanks!

Hi thanks,
You are running the latest build or running from master?
I will try and repro on master.

I've used the master repo, and built it with your tooling.

Please try the latest master. It should be fixed. Please note to restore yarn packages too, as I too the opportunity to do some updates.

Thanks for the quick fix, now it is working as expected!

2 minor errors: yarn fails to update anything if the build script is not run as Administrator under w10 (it fails on updating some md files..); and I needed to manually remove the "upath@^1.0.0: [....]" part from yarn.lock, because there was an obsolete dependency somewhere in the upstream packages.

I was just interested in the technical part, but I've noticed one possible ui bug: I'm uploading september data, on the /report/budget page defaults to october.

I can't reproduce the yarn issue, nor can Travis or Appveyor. Still proves the node ecosystem is a mess I guess.

Regarding that bug, you are right. The archive page is actually wrong.