Open Closed

Multiple issues with Commercial Blazor Server template 5.2-rc1 #2727


User avatar
0
wojt created
  • ABP Framework version: v5.2-rc 1 (CLI & Suite)
  • UI type: Blazor Server
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:
      1. Create new solution using ABP Suite and above settings
      1. Run lib-install
      1. Fix the known start up issues (flag-icon)
      1. Add some entities using ABP Suite,without using migrations in sutie (in my case, a Product, a Supplier, and Categories).
      1. Add relationships: Product->Supplier (1:1), Product:Categories (1:many)
      1. Fix razor.cs pages DataGrid SortDirections
      1. Add Migration and Update Database
      1. Run solution

Straight away, on every first run, I get exceptions. They vary, but this is one example: Error: System.InvalidOperationException: ExecuteReader requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized. ... at Volo.Abp.LanguageManagement.EntityFrameworkCore.EfCoreLanguageTextRepository.GetList(String resourceName, String cultureName)

But I also get exceptions reporting the DataReader connection has not been closed, null reference exceptions, etc. If you Reload the page, it then works fine. Error: System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.AspNetCore.Components.Web.LeptonTheme.Components.ApplicationLayout.MainHeader.MainHeader.xpWj9u1bVH()

Then navigate to an entity list page (e.g. Products), and on the first time I access it: Error: System.InvalidOperationException: The ConnectionString property has not been initialized. at Microsoft.Data.SqlClient.SqlConnection.PermissionDemand() at Microsoft.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource 1 retry, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSourcretry, DbConnectionOptions userOptions) ...[snip] at Test52.Blazor.Pages.Products.GetNullableSupplierLookupAsync(String newValue) in C:\Users\wojt\source\repos\Tests\Test52\src\Test52.Blazor\Pages\Products.razor.cs:line 225 at Test52.Blazor.Pages.Products.OnInitializedAsync() in C:\Users\wojt\source\repos\Tests\Test52\src\Test52.Blazor\Pages\Products.razor.cs:line 65 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Again, reload the page and it works fine.

NOW, for even more errors, add a Category, add a Product, and then try adding a Category to a Product (i.e. use the 1 to many relationship): Error: System.ObjectDisposedException: Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling 'Dispose' on the context instance, or wrapping it in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances. Object name: 'Test52DbContext'.

The offending line in this case is in the ABP Suite-generated method SetCategoriesAsync in ProductManager.cs: var query = (await _categoryRepository.GetQueryableAsync()) .Where(x => categoryIds.Contains(x.Id)) .Select(x => x.Id);

Repo is here: https://github.com/wojtj/Test52


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please make your repo Private!

    Temporary solution.

    context.Services.AddSignalR(options =>
    {
        var p = options.GetType().GetProperty("HubFilters", BindingFlags.Default | BindingFlags.Instance | BindingFlags.NonPublic);
        var pp = p.GetValue(options);
        var m = typeof(List<IHubFilter>).GetMethod("Clear");
        m.Invoke(pp, BindingFlags.Default, null, null, null);
    
        options.AddFilter<AbpHubContextAccessorHubFilter>();
        options.AddFilter<AbpAuthenticationHubFilter>();
        options.AddFilter<AbpAuditHubFilter>();
    });
    
  • User Avatar
    0
    wojt created

    Thanks. Marked private. Will test later.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok

  • User Avatar
    0
    jhsanc created

    Hi, I had the same problem, after I upgrated my solution to Blazor Wasm 5.2.0-rc.1 and try to run again any entity from abp suite code generator, I had this error:

    [14:54:07 ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": {}, "validationErrors": null } [14:54:07 ERR] Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.crMnHITicG() at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.A9wnsuiZ3C(String ) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.Catn1RSTBA() at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.ExecuteAsync(CrudPageCommandOptions options) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.CommandManager.ExecuteAllAsync(CrudPageCommandOptions options) at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.CrudPageGenerator.GenerateAsync(EntityModel entity, Solution solution) at Volo.Abp.Suite.Controllers.CrudPageGeneratorController.SaveAndGenerateEntityAsync(Guid solutionId, EntityModel entity) at lambda_method1814(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.

    Can you help me with that?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @jhsanc

    See https://support.abp.io/QA/Questions/2727#answer-d44f7341-e939-7e55-ce9b-3a0298305e5c

    We will fix this in rc2. today the rc2 will be released.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09