Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.26k stars 526 forks source link

Method not found: 'Void Blazorise.Modules.BaseJSModule (DataGrid) #5685

Closed sturlath closed 3 weeks ago

sturlath commented 1 month ago

Blazorise Version

1.6.0

What Blazorise provider are you running on?

Bootstrap5

Link to minimal reproduction or a simple code snippet

If I update my abp.io (version 8.2.1) projects Blazorise from 1.5.3 to 1.6.0 I get the following exception.

Unhandled exception rendering component: Method not found: 'Void Blazorise.Modules.BaseJSModule..ctor(Microsoft.JSInterop.IJSRuntime, Blazorise.IVersionProvider)'. System.MissingMethodException: Method not found: 'Void Blazorise.Modules.BaseJSModule..ctor(Microsoft.JSInterop.IJSRuntime, Blazorise.IVersionProvider)'. at Blazorise.DataGrid.JSDataGridModule..ctor(IJSRuntime jsRuntime, IVersionProvider versionProvider) at Blazorise.DataGrid.BaseDataGridComponent.OnInitialized() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Blazorise.DataGrid.DataGrid1.SetParametersAsync(ParameterView parameters) [10:10:29 ERR] Unhandled exception in circuit '89BBKUt_Q5D6LVbxZIsEJddhtm9kepM6ZMnvOqG06Ng'. System.MissingMethodException: Method not found: 'Void Blazorise.Modules.BaseJSModule..ctor(Microsoft.JSInterop.IJSRuntime, Blazorise.IVersionProvider)'. at Blazorise.DataGrid.JSDataGridModule..ctor(IJSRuntime jsRuntime, IVersionProvider versionProvider) at Blazorise.DataGrid.BaseDataGridComponent.OnInitialized() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Blazorise.DataGrid.DataGrid1.SetParametersAsync(ParameterView parameters)

Hopefully this can be fixed on your end and not abp.io since my licence is up there and I don´t plan on updating until after .net 9

Steps to reproduce

Update a abp.io frameworks Blazorise to 1.6.0.

What is expected?

No exception when running

What is actually happening?

Exception

What browsers do you see the problem on?

Microsoft Edge

Any additional comments?

No response

stsrki commented 1 month ago

It might be that not all ABP references to Blazorise packages are updated. Can you recheck your project and see if there is no 1.5.3 still left?

sturlath commented 1 month ago

I tried again to update and I still hit this error. Here is my csproj file in all its glory

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
    <PreserveCompilationReferences>true</PreserveCompilationReferences>
  </PropertyGroup>
  <PropertyGroup>
    <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
  </PropertyGroup>
  <ItemGroup>
    <None Remove="authserver.pfx" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="authserver.pfx">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="BlazorDownloadFileFast" Version="0.2.0" />
    <PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
    <PackageReference Include="Blazorise.Charts" Version="1.6.0" />
    <PackageReference Include="Blazorise.SpinKit" Version="1.6.0" />
    <PackageReference Include="Blazorise.Bootstrap5" Version="1.6.0" />
    <PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.6.0" />
    <PackageReference Include="Blazorise.Video" Version="1.6.0" />
    <PackageReference Include="AspNetCore.HealthChecks.UI" Version="8.0.1" />
    <PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="8.0.1" />
    <PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="8.0.1" />
    <PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
    <PackageReference Include="Serilog.Sinks.Async" Version="2.0.0" />
    <PackageReference Include="DistributedLock.Redis" Version="1.0.3" />
    <PackageReference Include="Syncfusion.Blazor.FileManager" Version="25.1.41" />
    <PackageReference Include="Syncfusion.Blazor.PdfViewerServer.Windows" Version="25.1.41" />
    <PackageReference Include="Syncfusion.Blazor.Themes" Version="25.1.41" />
    <PackageReference Include="Syncfusion.Pdf.Net.Core" Version="25.1.41" />
    <PackageReference Include="Volo.Docs.Admin.Web" Version="8.2.1" />
    <PackageReference Include="Volo.Docs.Web" Version="8.2.1" />
    <PackageReference Include="Volo.Payment.Admin.Blazor" Version="8.2.1" />
    <PackageReference Include="Volo.Payment.Admin.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="8.0.6" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="8.0.6" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="8.0.6" />
    <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.6" />
    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.6" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.DistributedLocking" Version="8.2.1" />
    <ProjectReference Include="..\BSR.Beinni.Application\BSR.Beinni.Application.csproj" />
    <ProjectReference Include="..\BSR.Beinni.HttpApi\BSR.Beinni.HttpApi.csproj" />
    <ProjectReference Include="..\BSR.Beinni.EntityFrameworkCore\BSR.Beinni.EntityFrameworkCore.csproj" />
    <PackageReference Include="Volo.Abp.Autofac" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.Swashbuckle" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.Account.Pro.Public.Web.OpenIddict" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.Account.Pro.Public.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.Account.Pro.Admin.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.Account.Pro.Public.Web.Impersonation" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.AuditLogging.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.Identity.Pro.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.OpenIddict.Pro.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.LanguageManagement.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Saas.Host.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.TextTemplateManagement.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.Gdpr.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.CmsKit.Pro.Admin.Blazor.Server" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.LeptonTheme.Management.Blazor.Server" Version="8.2.1" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton" Version="8.2.1" />
    <PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonTheme" Version="8.2.1" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="wwwroot\assets\" />
  </ItemGroup>
  <ItemGroup>
    <Content Update="wwwroot\favicon.ico">
      <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>
</Project>
David-Moreira commented 1 month ago

Whenever there's something like "Method not found" or something missing, that really should be in there, it's probable that's due to some trimming done incorrectly.

I'm guessing that the debug version or disabling trimming makes it so this problem does not happen. Is this correct?

sturlath commented 1 month ago

This is hapening while debugging.. adding the following doesn´t change anything

<PropertyGroup>
  <PublishTrimmed>false</PublishTrimmed>
  <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
</PropertyGroup>

Anything else I can try out?

David-Moreira commented 1 month ago

Then my assumption might be incorrect. However since apb is a middle man I don't know if they could trim possibly trim blazorise libs themselves.

Is there no way to load the blazorise libraries yourself?

sturlath commented 1 month ago

This is happning in the DataGrid (from what I can view from the error) and there are something extra there from Volo.Abp.BlazoriseUI.Components

 <ChildContent>
      @* these here below for example are from that namespace*@
     <DataGridEntityActionsColumn >
         <DisplayTemplate>
             <EntityActions >

See the docs on DataGridEntityActionsColumn

I can´t remove or change them (since I´m using it everywhere)... so the issue must be that they are using some method that you removed? 🤷‍♂️

And I can´t find anything about trimming in the abp docs... still searching...

David-Moreira commented 1 month ago

So did you mean to say that you remove that component and it started working?

I have my doubts it being something with the code itself. I think it has more to do with packages or build process. Did you also cross open an issue over at apb to get their insights?

sturlath commented 1 month ago

I stripped the page down to just this here and it still fails

<DataGrid TItem="StreamEventWithNavigationPropertiesDto"
          Data="UpcomingOrLiveStreamEventList"
          ReadData="LoadUpcomingAndLiveEventsFromService"
          TotalItems="UpcomingTotalCount"
          ShowPager="true"
          Responsive="true"
          RowStyling="@OnRowStyling"
          PageSize="PageSize">
    <ChildContent>
        <DataGridColumn TItem="StreamEventWithNavigationPropertiesDto"
                        Field="EventPriceInfo.RecordingStreamingPrice"
                        Caption="@L["RecordingStreamingPrice"]">
        </DataGridColumn>
    </ChildContent>
</DataGrid>

These here are the usings if they matter at all.. I gave up on trying to remove them...since the backend code uses lots of them..

@attribute [Authorize(BeinniPermissions.StreamEvents.Default), Authorize(BeinniPermissions.StreamEvents.Create)]
@using BSR.Beinni.Blazor.Shared;
@using BSR.Beinni.DownloadPaths;
@using BSR.Beinni.MediaKindStreamingInformations
@using BSR.Beinni.StreamEvents
@using Blazored.LocalStorage;
@using Microsoft.AspNetCore.Authorization
@using Microsoft.Extensions.Configuration
@using Volo.Abp.AspNetCore.Components.Web.Theming.Layout
@using BSR.Beinni.Permissions
@using BSR.Beinni.Blazor.Components
@using Volo.Abp.MultiTenancy
@using Blazorise.Video
@using Volo.Abp.AspNetCore.Components.Messages
@implements IAsyncDisposable
@inherits BeinniComponentBase
@inject NavigationManager NavigationManager
@inject ClipboardService ClipboardService
@inject IFrameService IFrameService
@inject IStreamEventsAppService StreamEventsAppService
@inject IDownloadPathsAppService DownloadPathAppService
@inject ICurrentTenant CurrentTenant
@inject IJSRuntime JS
@inject IConfiguration Configuration
@inject IUiMessageService uiMessageService
@inject TokenProvider provider
@inject ILocalStorageService localStorage

And I created an issue at abp.io @David-Moreira

David-Moreira commented 1 month ago

Yep, so you've stripped down pretty much to just our DataGrid in v1.6. If anything was wrong with it, our demos, docs wouldn't be working, and we'd have a ton of complaints certainly, v1.6 has been out for a while.

https://blazorise.com/docs/extensions/datagrid/binding-data/in-memory

Let's see if apb can help us out.

stsrki commented 1 month ago

You might have updated Blazorise packages but you also need to check that some deeply nested package is not left on older version. In VS go to solution explorer and expand all packages to investigate

image

David-Moreira commented 3 weeks ago

Another use has just reported something similar over discord. image

Since it seems like this user does not use apb, I would suspect that Blazorise might have some issue with trimming now that it did not have on previous versions, so we need to investigate.

David-Moreira commented 3 weeks ago

@sturlath apparently good news. A user figured out this was happening on sdk 8.0.3 and updating to 8.0.4 fixed it. Could I ask that you update and let us know if that fixes it?

Pat : "Moving to new SDK fixed it"

sturlath commented 3 weeks ago

@David-Moreira I´m running 8.0.400-preview.0.24324.5 so that will not help me at least.

BUT to fix this we can just install the Blazorise.DataGridnuget separatly (see comments in https://github.com/abpframework/abp/issues/20482). I just dind´t think of doing that because I was sure it wouldn´t work!

David-Moreira commented 3 weeks ago

@David-Moreira I´m running 8.0.400-preview.0.24324.5 so that will not help me at least.

BUT to fix this we can just install the Blazorise.DataGridnuget separatly (see comments in abpframework/abp#20482). I just dind´t think of doing that because I was sure it wouldn´t work!

Well I did ask you :

Is there no way to load the blazorise libraries yourself?

haha

Anyway, glad you got it working. We suspect that the culprit was the .NET Core framework as that was what it fixed for another user, but please let us know otherwise.

(In the case of APB, I suspect that they should recompile making sure that they are on latest .NET)

sturlath commented 3 weeks ago

Well I did ask you

🙈 yes sorry.. totally missed what that might mean.. I´m just so used to them being an issue (to be fair its been some time since it was actually but I was just so sure about it).

David-Moreira commented 3 weeks ago

Well I did ask you

🙈 yes sorry.. totally missed what that might mean.. I´m just so used to them being an issue (to be fair its been some time since it was actually but I was just so sure about it).

I can relate, I know how frustrating it is to want to get work done, and a framework or library let us down and to waste hours trying to even figure out what the hell is going on without being able to get work done...

Anyway I believe the .NET framework days were darker times compared to today haha.

I'm going to close this issue for now, but please do re-open if something's not working correctly related to this.