Lombiq / Open-Source-Orchard-Core-Extensions

Looking for some useful Orchard Core extensions? Here's a bundle solution of all of Lombiq's open-source Orchard Core extensions (modules and themes). Clone and try them out!
https://lombiq.com
BSD 3-Clause "New" or "Revised" License
47 stars 19 forks source link

Upgrade to latest OC preview to test System.Text.Json (OSOE-795) #692

Closed Piedone closed 5 months ago

Piedone commented 8 months ago

After https://github.com/OrchardCMS/OrchardCore/pull/14572, OC now uses System.Text.Json instead of Json.NET. So, let's upgrade to this preview version and test if anything is broken.

Jira issue

Piedone commented 8 months ago

Something you might be interested in @sarahelsaig?

sarahelsaig commented 8 months ago

Yes!

Piedone commented 8 months ago

It's yours, then :).

sarahelsaig commented 7 months ago

Almost done, except the SQL Server UI tests fail now, of all things. I've pasted the message below. Do you have any hint, @Piedone ? I recall recently you did an issue related to MultipleActiveResultSets.

2024-03-18 02:20:09.5435|Default|00-d897ab0f006a4b692dcc0d6793ea5912-e6ed5a8c98c88afb-00||OrchardCore.Environment.Shell.ShellFeaturesManager|ERROR|IFeatureEventHandler thrown from OrchardCore.Roles.Services.RoleUpdater by InvalidOperationException System.InvalidOperationException: The connection does not support MultipleActiveResultSets.
   at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__211_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
   at YesSql.Store.ProduceAsync[T,TState](WorkerQueryKey key, Func`2 work, TState state)
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at OrchardCore.Data.Documents.DocumentStore.GetOrCreateMutableAsync[T](Func`1 factoryAsync)
   at OrchardCore.Documents.DocumentManager`1.GetOrCreateMutableAsync(Func`1 factoryAsync)
   at OrchardCore.Roles.Services.RoleUpdater.UpdateRolesForInstalledFeatureAsync(IFeatureInfo feature)
   at OrchardCore.Modules.InvokeExtensions.InvokeAsync[TEvents,T1](IEnumerable`1 events, Func`3 dispatch, T1 arg1, ILogger logger)    at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__211_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
   at YesSql.Store.ProduceAsync[T,TState](WorkerQueryKey key, Func`2 work, TState state)
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at OrchardCore.Data.Documents.DocumentStore.GetOrCreateMutableAsync[T](Func`1 factoryAsync)
   at OrchardCore.Documents.DocumentManager`1.GetOrCreateMutableAsync(Func`1 factoryAsync)
   at OrchardCore.Roles.Services.RoleUpdater.UpdateRolesForInstalledFeatureAsync(IFeatureInfo feature)
   at OrchardCore.Modules.InvokeExtensions.InvokeAsync[TEvents,T1](IEnumerable`1 events, Func`3 dispatch, T1 arg1, ILogger logger)
2024-03-18 02:20:11.0334|Default|00-d897ab0f006a4b692dcc0d6793ea5912-e6ed5a8c98c88afb-00||OrchardCore.Environment.Shell.ShellFeaturesManager|ERROR|IFeatureEventHandler thrown from OrchardCore.Roles.Services.RoleUpdater by InvalidOperationException System.InvalidOperationException: The connection does not support MultipleActiveResultSets.
   at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__211_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
   at YesSql.Store.ProduceAsync[T,TState](WorkerQueryKey key, Func`2 work, TState state)
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at OrchardCore.Data.Documents.DocumentStore.GetOrCreateMutableAsync[T](Func`1 factoryAsync)
   at OrchardCore.Documents.DocumentManager`1.GetOrCreateMutableAsync(Func`1 factoryAsync)
   at OrchardCore.Roles.Services.RoleUpdater.UpdateRolesForInstalledFeatureAsync(IFeatureInfo feature)
   at OrchardCore.Modules.InvokeExtensions.InvokeAsync[TEvents,T1](IEnumerable`1 events, Func`3 dispatch, T1 arg1, ILogger logger)    at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__211_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
   at YesSql.Store.ProduceAsync[T,TState](WorkerQueryKey key, Func`2 work, TState state)
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
   at OrchardCore.Data.Documents.DocumentStore.GetOrCreateMutableAsync[T](Func`1 factoryAsync)
   at OrchardCore.Documents.DocumentManager`1.GetOrCreateMutableAsync(Func`1 factoryAsync)
   at OrchardCore.Roles.Services.RoleUpdater.UpdateRolesForInstalledFeatureAsync(IFeatureInfo feature)
   at OrchardCore.Modules.InvokeExtensions.InvokeAsync[TEvents,T1](IEnumerable`1 events, Func`3 dispatch, T1 arg1, ILogger logger)
Piedone commented 7 months ago

Yes, see https://github.com/Lombiq/UI-Testing-Toolbox/issues/343 and https://github.com/OrchardCMS/OrchardCore/issues/15224. This looks like an OC bug in the Roles module (and a new one since 1.8), then, most possibly some unwanted multi-threaded SQL query. Please add details to the OC issue and fix it if you can.

Piedone commented 5 months ago

The https://github.com/OrchardCMS/OrchardCore/pull/13181 PR changed the registration order of the authentication middleware. This might break BlockMediaThemeTemplateDirectAccessMiddleware. Please make sure it's not broken.

Piedone commented 5 months ago

Now the blocking bugs are fixed, so tomorrow morning the updated packages should be on Cloudsmith. Please also see the localization thing I added above.

sarahelsaig commented 5 months ago

Oh, what a relief! I will update the packages and validate the results during the weekend.

Piedone commented 5 months ago

Thanks! FYI @MikeAlhayek.

Piedone commented 5 months ago

Issues like https://github.com/OrchardCMS/OrchardCore/issues/15628 can now be made apparent, even with SQLite, with the new EnableThreadSafetyChecks YesSql config. Please enable those for UI tests, see https://github.com/OrchardCMS/OrchardCore/pull/15961.

Piedone commented 5 months ago

Is this intentionally not closed @dministro?