Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[blazor][wasm] load .js and .wasm assets by runtime #43049

Closed
wants to merge 12 commits into from

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Aug 2, 2022

  • use config.assets to pass URL of dotnet.wasm and dotnet-crypto-worker.js
  • pass downloadResource callback to runtime which bridges the runtime to use WebAssemblyResourceLoader for loading assets
  • let runtime to do streaming instantiateWasm
  • change to WebAssemblyResourceLoader to return absolute URLs. For debugger purposes.
  • add new type definitions
  • use setModuleImports instead of IMPORTS

@pavelsavara pavelsavara added feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly arch-wasm labels Aug 2, 2022
@pavelsavara pavelsavara added this to the 7.0-rc1 milestone Aug 2, 2022
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Aug 2, 2022
@pavelsavara

This comment was marked as outdated.

@pavelsavara pavelsavara marked this pull request as ready for review August 12, 2022 10:35
@pavelsavara pavelsavara requested a review from a team as a code owner August 12, 2022 10:35
@lambdageek lambdageek self-assigned this Aug 12, 2022
@pavelsavara
Copy link
Member Author

The issue is
error: Failed to start platform. Reason: TypeError: Cannot convert undefined or null to object at Kt (http://127.0.0.1:38689/subdir/_framework/blazor.webassembly.js:1:61927

I didn't dig deeper yet.

@lambdageek
Copy link
Member

Repros locally.

Is there a way to run one of the E2E tests by hand in a browser to debug the JavaScript? (ie without Selenium)

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Aug 16, 2022

@lambdageek Yes. Start up the src\Components\test\testassets\TestServer project. It will present a UI with a dropdown that lets you pick which test component you want to run.

You may have to visit something like https://localhost:5003/subdir once the testserver is running - can't remember the URL exactly. The browser might open with it automatically. It does a weird thing where the port number changes each time you start it.

return undefined;
};

const runtimeAssets = resourceLoader.bootConfig.resources.runtimeAssets;
Copy link
Member

@lambdageek lambdageek Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the problem for the E2E tests:

resourceLoader.bootConfig.resources doesn't have a runtimeAssets key. It has a runtime key, is that what we want?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it needs to be in sync with

https://github.com/dotnet/sdk/blob/4547cf714749f732b53a5c70edd269a33e75bd28/src/BlazorWasmSdk/Tasks/BootJsonData.cs#L14

according to the comment in

// Keep in sync with bootJsonData from the BlazorWebAssemblySDK
export interface BootJsonData {

and indeed that defines

https://github.com/dotnet/sdk/blob/4547cf714749f732b53a5c70edd269a33e75bd28/src/BlazorWasmSdk/Tasks/BootJsonData.cs#L61-L64

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lambdageek no, there was a change in the SDK (last week I think) to add this additional key.

Copy link
Member

@lambdageek lambdageek Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah runtimeAssets are there too.
https://github.com/dotnet/sdk/blob/4547cf714749f732b53a5c70edd269a33e75bd28/src/BlazorWasmSdk/Tasks/BootJsonData.cs#L106

Maybe we just need to merge this PR with main to get an SDK bump?

Or maybe the E2E tests are using the sdk from <gitroot>/.dotnet and that one is older?

Copy link
Member

@lambdageek lambdageek Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging main wasn't enough. we probably need the SDK update PR #43028.

I'm verifying locally...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success! We're blocked on an SDK bump

Screen Shot 2022-08-16 at 13 07 13

@lambdageek
Copy link
Member

Not sure what the next steps are here. I think we still want this for net7 rc1. But it's unclear to me if the sdk bump PR is going into that branch

/cc @lewing

@mkArtakMSFT mkArtakMSFT removed this from the 7.0-rc1 milestone Sep 14, 2022
@pavelsavara
Copy link
Member Author

replaced by #45628

@ghost
Copy link

ghost commented Dec 16, 2022

Hi @pavelsavara. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants