We are a little bit closer to the solution. At this moment I am still not able to post an image due to a poblem in the suggested MyDynamicWidgetMarkdown
The line 59 below will cause an 'Object reference not set to an instance of an object.', because GetConfigurationOrDefaultOrNull(CmsKitAdminRemoteServiceConsts.RemoteServiceName)
is returning null
The MyProject.Public.Web
has a login button, but this button does not redirect to the loginpage of the Blazor application.
Is this a bug, or a feature? If it is a feature, what is the correct way to implement the Login/Logout of the MyProject.Public.Web project
https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/Components/Toolbar/LoginLink/Default.cshtml
I think the code should be changed to use the AuthServer:Authority
setting
@inject IConfiguration c;
<a class="btn" role="button" href="@((c["AuthServer:Authority"] ?? "~").EnsureEndsWith('/'))Account/Login"><i class="fa fa-sign-in me-1"></i> @L["Login"]</a>
In the MyProjectNameMenuContributor.cs
I notice that the Account.Manage
is using the setting partially. The logout
is not using this setting.
https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/Menus/MyProjectNameMenuContributor.cs
I think the code should be changed to use the AuthServer:Authority
setting
context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", uiResource["Logout"], url: $"{authServerUrl.EnsureEndsWith('/')}Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000).RequireAuthenticated());
The new implementation of DynamicWidgetMarkdowndoes not work either.
steps to repeat this error with this new file:
I created again a brand new solition using the Blazor Server + SQLite template
run the DbMigration
create new blog
create new blogpost
upload an image in the bogpost content body.
Visual Studio will hit my breakpoint in MyDynamicWidgetMarkdown.OnImageUploadChangedAsync
(so the new implementation is used)
nothing happens, but after 30 seconds, my breakpoint at the first line in MyDynamicWidgetMarkdown.OnImageUploadEndedAsync
is hit (at this moment the blazor code gives no error, but the browser gives the error below
At this moment the logfile ends with:
2023-01-14 16:18:19.067 +01:00 [INF] Sending file. Request path: '/_content/Blazorise/io.js'. Physical path: 'C:\Users\info\.nuget\packages\blazorise\1.1.4.1\staticwebassets\io.js'
2023-01-14 16:18:19.068 +01:00 [INF] Request finished HTTP/2 GET https://localhost:44392/_content/Blazorise/io.js?v=1.1.4.1 - - - 200 4775 application/javascript 11.1416ms
2023-01-14 16:19:19.096 +01:00 [ERR] Unhandled exception in circuit 'TuWLV-IIgye0XQ7K7wDOrJaC_GEtWd8O-AIuyvFD47U'.
System.TimeoutException: Did not receive any data in the allotted time.
at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
at System.IO.Pipelines.Pipe.GetReadAsyncResult()
at System.IO.Pipelines.PipeReaderStream.ReadAsyncInternal(Memory`1 buffer, CancellationToken cancellationToken)
2023-01-14 16:19:19.102 +01:00 [INF] Executed endpoint '/_blazor'
2023-01-14 16:19:19.102 +01:00 [INF] Request finished HTTP/1.1 GET https://localhost:44392/_blazor?id=Bqa8rGpLr0aYGXfC80d77w - - - 101 - - 98820.3319ms
await file.WriteToStreamAsync(UploadImages[file.Id]);
my visual studio breaks the application with the error below.No additional information is added to the logfile
I hope this five
ABP Framework version: v7.0.0 UI type: Blazor DB provider: EF Core , tested on PostgreSQL and SQLite Tiered (MVC) : no
Steps to reproduce the issue:"
Drag-and-drop an image, then an exception will be thrown:
UI Message An internal error occurred during your request! Log.txt Exception message and stack trace: 2023-01-12 19:27:41.299 +01:00 [ERR] The given key '1' was not present in the dictionary. System.Collections.Generic.KeyNotFoundException: The given key '1' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Volo.CmsKit.Pro.Admin.Blazor.Pages.CmsKit.DynamicWidgetMarkdown.OnImageUploadEndedAsync(FileEndedEventArgs e) at Blazorise.Markdown.Markdown.UpdateFileEndedAsync(IFileEntry fileEntry, Boolean success, FileInvalidReason fileInvalidReason) at Blazorise.RemoteFileEntryStreamReader.WriteToStreamAsync(Stream stream, CancellationToken cancellationToken) at Blazorise.FileEntry.WriteToStreamAsync(Stream stream, CancellationToken cancellationToken) at Volo.CmsKit.Pro.Admin.Blazor.Pages.CmsKit.DynamicWidgetMarkdown.OnImageUploadChangedAsync(FileChangedEventArgs e)
Same exception happens when creating a page and drag-and-drop an image in the content block
Another issue with images in blogposts is when click Cover Image - 'Choose File', select an image (I do not hit the Publish or Save buttons). Nothing happens, but after 30 sec, visual studio break as shown below
For your information, I was working on the posibility to switch between sqlite and postgresql as a database provider, but the generated code is not compatible to support the 2 database providers. Therefore I have decided to use postgresql as the only compatible database provider.
Therefore, this question is no longer a blocking issue in my situation.
The TransactionBehavior is already configured in the bootstrapped code created by the abp suite.
see line 63 in : src\CreateTenantUsingSqlite.EntityFrameworkCore\EntityFrameworkCore\CreateTenantUsingSqliteEntityFrameworkCoreModule.cs
2023-01-04 09:22:46.413 +01:00 [ERR] An exception occurred in the database while saving changes for context type 'Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
at Microsoft.Data.Sqlite.SqliteTransaction..ctor(SqliteConnection connection, IsolationLevel isolationLevel, Boolean deferred)
at Microsoft.Data.Sqlite.SqliteConnection.BeginTransaction(IsolationLevel isolationLevel, Boolean deferred)
at Microsoft.Data.Sqlite.SqliteConnection.BeginTransaction(IsolationLevel isolationLevel)
at Microsoft.Data.Sqlite.SqliteConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at System.Data.Common.DbConnection.BeginDbTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
at Microsoft.Data.Sqlite.SqliteTransaction..ctor(SqliteConnection connection, IsolationLevel isolationLevel, Boolean deferred)
at Microsoft.Data.Sqlite.SqliteConnection.BeginTransaction(IsolationLevel isolationLevel, Boolean deferred)
at Microsoft.Data.Sqlite.SqliteConnection.BeginTransaction(IsolationLevel isolationLevel)
at Microsoft.Data.Sqlite.SqliteConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at System.Data.Common.DbConnection.BeginDbTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Volo.Abp.EntityFrameworkCore.AbpDbContext`1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
2023-01-04 09:22:46.674 +01:00 [ERR] SQLite Error 5: 'database is locked'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
at Microsoft.Data.Sqlite.SqliteTransaction..ctor(SqliteConnection connection, IsolationLevel isolationLevel, Boolean deferred)
at Microsoft.Data.Sqlite.SqliteConnection.BeginTransaction(IsolationLevel isolationLevel, Boolean deferred)
at Microsoft.Data.Sqlite.SqliteConnection.BeginTransaction(IsolationLevel isolationLevel)
at Microsoft.Data.Sqlite.SqliteConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at System.Data.Common.DbConnection.BeginDbTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransactionAsync(CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Volo.Abp.EntityFrameworkCore.AbpDbContext`1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Volo.Abp.Uow.UnitOfWork.SaveChangesAsync(CancellationToken cancellationToken)
at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken)
at Volo.Abp.Users.UserLookupService`2.WithNewUowAsync(Func`1 func)
at Volo.Abp.Users.UserLookupService`2.FindByIdAsync(Guid id, CancellationToken cancellationToken)
at Volo.CmsKit.Users.CmsUserSynchronizer.HandleEventAsync(EntityUpdatedEto`1 eventData)
at Volo.Abp.EventBus.EventHandlerInvoker.InvokeAsync(IEventHandler eventHandler, Object eventData, Type eventType)
at Volo.Abp.EventBus.EventBusBase.TriggerHandlerAsync(IEventHandlerFactory asyncHandlerFactory, Type eventType, Object eventData, List`1 exceptions, InboxConfig inboxConfig)
at System.AbpExceptionExtensions.ReThrow(Exception exception)
at Volo.Abp.EventBus.EventBusBase.ThrowOriginalExceptions(Type eventType, List`1 exceptions)
at Volo.Abp.EventBus.EventBusBase.TriggerHandlersAsync(Type eventType, Object eventData)
at Volo.Abp.EventBus.Local.LocalEventBus.PublishAsync(LocalEventMessage localEventMessage)
at Volo.Abp.EventBus.Local.LocalEventBus.PublishToEventBusAsync(Type eventType, Object eventData)
at Volo.Abp.EventBus.EventBusBase.PublishAsync(Type eventType, Object eventData, Boolean onUnitOfWorkComplete)
at Volo.Abp.EventBus.UnitOfWorkEventPublisher.PublishDistributedEventsAsync(IEnumerable`1 distributedEvents)
at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken)
at CreateTenantUsingSqlite.Data.CreateTenantUsingSqliteTenantDatabaseMigrationHandler.MigrateAndSeedForTenantAsync(Guid tenantId, String adminEmail, String adminPassword) in c:\projects\AbpTests\CreateTenantUsingSqlite\src\CreateTenantUsingSqlite.Domain\Data\CreateTenantUsingSqliteTenantDatabaseMigrationHandler.cs:line 121
Create a brand new solution using abp suite using Database management system, Sqlite
run db migration
(before running the blazor server, work around this issue https://support.abp.io/QA/Questions/3923/Could-not-find-the-bundle-file-%27libsbootstrapcssbootstrapcss%27-for-the-bundle-%27BlazorLeptonXThemeGlobal%27 copy libs from \src\ZichtOpGrond.Web.Public\wwwroot\libs\ to \src\ZichtOpGrond.Blazor\wwwroot\libs\ : abp, bootstrap, datatables.net, jquery-form, luxon
run blazor server
Create a new tenant. When you look in the logfile, you'll see the deadlock errors