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 and .NET6 creates an error: EntrypointInvoker in assembly Microsoft.AspNetCore.Components.WebAssembly #38436

Closed
erossini opened this issue Nov 16, 2021 · 21 comments
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved

Comments

@erossini
Copy link

I have my simple project with Blazor. I updated the project from .NET5 to .NET6. I deploy to the production environment using Web Deploy. On the production server, I am getting this error

Error: Could not find class: Microsoft.AspNetCore.Components.WebAssembly.Hosting:EntrypointInvoker in assembly Microsoft.AspNetCore.Components.WebAssembly

image

The configuration of Web Deploy is

image

@TanayParikh TanayParikh transferred this issue from dotnet/core Nov 16, 2021
@TanayParikh TanayParikh added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Nov 16, 2021
@TanayParikh
Copy link
Contributor

Hello, thanks for contacting us. The EntrypointInvoker was removed in .NET 6 (via #31769). This seems to indicate the app is still TFM 5. Could you please show us what the .csproj looks like for this project?

@TanayParikh TanayParikh added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Nov 16, 2021
@ghost
Copy link

ghost commented Nov 16, 2021

Hi @erossini. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@erossini
Copy link
Author

This is the csproj

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
    <PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\PSC.Blazor.Components.DataTable\PSC.Blazor.Components.DataTable.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Content Update="wwwroot\img\psc_logo.png">
      <PackagePath>\</PackagePath>
      <Pack>True</Pack>
    </Content>
  </ItemGroup>

</Project>

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Nov 16, 2021
@pranavkm
Copy link
Contributor

@erossini do you also mind including the obj\project.assets.json for this file? It might be one of your references is causing an older version of blazor.webassembly.js to be used, instead of the 6.0.0 version, and the resolved package references might give us some hints. Alternatively, if there's a minimal app you could share with us that reproduces the problem, that would be great.

@mkArtakMSFT mkArtakMSFT added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Nov 16, 2021
@ghost
Copy link

ghost commented Nov 16, 2021

Hi @erossini. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@erossini
Copy link
Author

This is the project.assets.json

project.assets.zip

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Nov 17, 2021
@legistek
Copy link

Same problem here. I cleared out all bin/obj and other intermediate files I could find.

@legistek
Copy link

Ohh but clearing my browser cache fixed it. Try that!

@erossini
Copy link
Author

erossini commented Nov 17, 2021

ohh @legistek you are right. It made me crazy... simple solution... Thank you everybody! Here the result

@pranavkm
Copy link
Contributor

Do you have your server configured to include the correct cache headers? For instance, in a Blazor hosted app, or in development, Blazor will include the following headers when serving this file:

image

If you are unable to configure the server headers, you could consider using some cache busting mechanism such as adding a nonce to your blazor.webassembly.js script src.

@pranavkm pranavkm added ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Nov 17, 2021
@ghost ghost added the Status: Resolved label Nov 17, 2021
@erossini
Copy link
Author

erossini commented Nov 17, 2021

Do you have your server configured to include the correct cache headers? For instance, in a Blazor hosted app, or in development, Blazor will include the following headers when serving this file:

image

If you are unable to configure the server headers, you could consider using some cache busting mechanism such as adding a nonce to your blazor.webassembly.js script src.

I use an hosting provider and I don't have a lot of option to change the configuration of the server. When you say "cache busting mechanism", what do you mean? How can I do that?

I saw those links:

@legistek
Copy link

Good to know @pranavkm thanks! My only hesitation though is won't that hurt us with those large AOT payloads?

@erossini
Copy link
Author

Good to know @pranavkm thanks! My only hesitation though is won't that hurt us with those large AOT payloads?

Why do you use AOT? In my test, it is working also without it

@legistek
Copy link

Good to know @pranavkm thanks! My only hesitation though is won't that hurt us with those large AOT payloads?

Why do you use AOT? In my test, it is working also without it

I'm just asking if the HTTP headers prohibited caching, wouldn't that make it slower for users to download the application after the first visit? I just mention AOT because it adds significant file size.

@pranavkm
Copy link
Contributor

pranavkm commented Nov 17, 2021

@legistek it's specifically for the blazor.webassembly.js file. Blazor manages downloading all other files which does not rely on the browser's HTTP cache. You can verify this by looking at your network tab after the app has been initialized once.

@legistek
Copy link

Ah very clever! Thanks for clarifying!

@ghost
Copy link

ghost commented Nov 18, 2021

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Nov 18, 2021
@Swimburger
Copy link

Ran into the same issue, but it wasn't in the browser cache, it was in the CDN cache (Cloudflare in my case).
Don't forget to purge the cache.

@ghost
Copy link

ghost commented Dec 2, 2021

Ran into the same issue, but it wasn't in the browser cache, it was in the CDN cache (Cloudflare in my case). Don't forget to purge the cache.

In my case the response header includes "x-cdn: Imperva" only when I'm off the corporate VPN. Get back on the VPN and the x-cdn falls off, and I see different values for content-length + ETag.

@SteveDunn
Copy link

Ran into the same issue, but it wasn't in the browser cache, it was in the CDN cache (Cloudflare in my case). Don't forget to purge the cache.

I'm getting the same issue with an Azure CDN. It must be the caching as the same app works from an in-private window

@SteveDunn
Copy link

I found that this works: change the line where you reference the .js file and add a version to the url, e.g.

<script src="_framework/blazor.webassembly.js?version=6"></script>

@ghost ghost locked as resolved and limited conversation to collaborators Jan 12, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. Status: Resolved
Projects
None yet
Development

No branches or pull requests

7 participants