mingyaulee / Blazor.BrowserExtension.Samples

Sample projects using Blazor to build browser extensions
MIT License
21 stars 5 forks source link

Unable to load WASM Dlls in chrome extension .NET7 #3

Closed geetShukla closed 1 year ago

geetShukla commented 1 year ago

Hi Team ,

I have created an browser extension with Blazor webassembly (mingyaulee) .I am unable to load WASM assembly in chrome extensions and getting error as "Cannot read properties of undefined (reading 'BrowserExtension')" and unable to load coreinternalJs files .

mingyaulee commented 1 year ago

Hi there, can you share a screenshot of the error or anything helpful from the extension error logs?

geetShukla commented 1 year ago

Hi there, can you share a screenshot of the error or anything helpful from the extension error logs? WASM_error_1 WASM_error_2

mingyaulee commented 1 year ago

I suspect that something is missing from the manifest. Are you loading any of the template extension from this project? If not, can you share the manifest you are using here?

geetShukla commented 1 year ago

I suspect that something is missing from the manifest. Are you loading any of the template extension from this project? If not, can you share the manifest you are using here?

@mingyaulee ..I have attached the Manifest and other required file ..can u pls verify that and lemme know what is the exact issue ..Thanks in Advance ..!

manifest.zip

mingyaulee commented 1 year ago

@geetShukla I have tried with the files you have uploaded with the integration test project assemblies, I removed all the icons from manifest and inserted a new div in the html with the element ID expected from the Blazor app, and it was loaded without any issue for me. So it is something else that is causing the error that you are getting (browser, network, etc.).

image

image

geetShukla commented 1 year ago

@mingyaulee Can you please share the files which u tried in integration test project .

mingyaulee commented 1 year ago

I used the project from the main repo to try out, but you can use any of the samples in this repo as well. Just copy your files to the compiled output browserextension directory and load it from the browser.

geetShukla commented 1 year ago

I used the project from the main repo to try out, but you can use any of the samples in this repo as well. Just copy your files to the compiled output browserextension directory and load it from the browser.

@mingyaulee if I am using the published code available in samples then I am able to load the extension properly .However when I am rebuilding the solution in VS2022 and publishing the code then the published code is not working and its giving error WASM_error_2 as attached . I have attached the rebuild setup and error screenshots .

WASM_Error1 browserextension.zip

mingyaulee commented 1 year ago

Based on the screenshots provided I am assuming you are not loading from the browserextension directory in the output. You can try to load it from there instead because _framework is not a valid folder name for a browser extension.

geetShukla commented 1 year ago

@mingyaulee can u pls check the attached setup here ..same I am using to load the extension in chrome and there I donot have any folder with _framework
browserextension.zip or _Content

geetShukla commented 1 year ago

@mingyaulee can u pls check the attached setup here ..same I am using to load the extension in chrome and there I donot have any folder with _framework browserextension.zip or _Content

@mingyaulee any update on this issue ..I have attached the setup in previous reply ..Can u pls check it and let me know what is wrong in that ..

mingyaulee commented 1 year ago

@geetShukla sorry I have been caught up in work recently. It seems like the publishing is causing issue when trimming and compression is enabled. A workaround for now is to disable both of them with

<PublishTrimmed>false</PublishTrimmed>
<BlazorEnableCompression>false</BlazorEnableCompression>

I am still figuring out what is causing it to break by testing with a standard Blazor app.

mingyaulee commented 1 year ago

@geetShukla I have looked into the extension you have uploaded, it seems like the publishing job was not done properly by this package (the contents of the JS files were not replaced). Maybe you can try again with the latest version of the dotnet SDK and use dotnet publish to publish the extension again.

mingyaulee commented 1 year ago

Closing due to inactivity