vikramlearning / blazorbootstrap

An Enterprise-class Blazor Bootstrap Component library built on the Blazor and Bootstrap CSS frameworks.
https://docs.blazorbootstrap.com/
Apache License 2.0
770 stars 40 forks source link

AutoComplete throws exception #97

Closed sanderweltje closed 2 years ago

sanderweltje commented 2 years ago

On a razor page with Autocomplete the following exception is thrown when navigating to a different page

Microsoft.JSInterop.JSException: Failed to execute 'querySelector' on 'Document': '0HMKO40BHF59Q' is not a valid selector. Error: Failed to execute 'querySelector' on 'Document': '0HMKO40BHF59Q' is not a valid selector. at r (https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js:6:813) at hi.getInstance (https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js:6:6646) at hi.getOrCreateInstance (https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js:6:6713) at Object.dispose (http://localhost:5000/_content/Blazor.Bootstrap/blazor.bootstrap.js:52:34) at http://localhost:5000/_framework/blazor.server.js:1:3501 at new Promise () at kt.beginInvokeJSFromDotNet (http://localhost:5000/_framework/blazor.server.js:1:3475) at http://localhost:5000/_framework/blazor.server.js:1:72001 at Array.forEach () at kt._invokeClientMethod (http://localhost:5000/_framework/blazor.server.js:1:71987) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at BlazorBootstrap.AutoComplete`1.DisposeAsync(Boolean disposing) at BlazorBootstrap.Base.BaseAfterRenderComponent.DisposeAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.g__GetHandledAsynchronousDisposalErrorsTask|64_0(Task result)

gvreddy04 commented 2 years ago

@sanderweltje Can you share the sample project or code to replicate the issue?

Please share the below info:

sanderweltje commented 2 years ago

I use Blazor Server net6.0 and Blazor.Bootstrap version 0.4.1. If I revert back to Blazor.Bootstrap version 0.4.0 the problem is gone. I attached a sample project created with VisualStudio 2022 AutoCompleteException.zip

sanderweltje commented 2 years ago

Thanks a lot, problem solved.