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 project deployed with error #43738

Closed
1 task done
coader opened this issue Sep 4, 2022 · 8 comments
Closed
1 task done

blazor wasm project deployed with error #43738

coader opened this issue Sep 4, 2022 · 8 comments
Labels
area-blazor Includes: Blazor, Razor Components feature-rendering Features dealing with how blazor renders components investigate

Comments

@coader
Copy link

coader commented Sep 4, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

debug is ok, and after deployed to IIS, show error below, already check version of referenced package:

determined url of main script to be http://localhost:8036/_framework/dotnet.7.0.0-preview.7.22375.6.d5v38wupev.js
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Arg_NoDefCTor, Project1.Shared.MainLayout
System.MissingMethodException: Arg_NoDefCTor, Flight.Blazor.Shared.MainLayout
at System.RuntimeType.CreateInstanceMono(Boolean , Boolean )
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean , Boolean )
at System.Activator.CreateInstance(Type , Boolean , Boolean )
at System.Activator.CreateInstance(Type , Boolean )
at System.Activator.CreateInstance(Type )
at Microsoft.AspNetCore.Components.DefaultComponentActiva

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

7.0.100-preview.7.22377.5

Anything else?

No response

@coader
Copy link
Author

coader commented Sep 4, 2022

only reference:

    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.7.22376.6" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-preview.7.22376.6" PrivateAssets="all" />

@TanayParikh TanayParikh added area-blazor Includes: Blazor, Razor Components feature-rendering Features dealing with how blazor renders components labels Sep 4, 2022
@coader
Copy link
Author

coader commented Sep 5, 2022

I have found it's caused by PublishTrimmed, it's ok for everything is default, but if publish with trimmed and link, will get this error

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Arg_NoDefCTor, BlazorApp1.Client.Shared.MainLayout
System.MissingMethodException: Arg_NoDefCTor, BlazorApp1.Client.Shared.MainLayout
   at System.RuntimeType.CreateInstanceMono(Boolean , Boolean )
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean , Boolean )

@coader
Copy link
Author

coader commented Sep 5, 2022

now I remove PublishTrimmed, and use compress config like this:
https://raw.githubusercontent.com/dotnet/AspNetCore.Docs/main/aspnetcore/blazor/host-and-deploy/webassembly/_samples/web.config

but get error when open sample fetch data page:

Uncaught (in promise) Error: System.Text.Json.JsonException: DeserializeUnableToConvertValue, System.String Path: $ | LineNumber: 0 | BytePositionInLine: 4.
 ---> System.InvalidOperationException: InvalidCast, True, string
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType )
   at System.Text.Json.Utf8JsonReader.GetString()
   at System.Text.Json.Serialization.Converters.StringConverter.Read(Utf8JsonReader& , Type , JsonSerializerOptions )
   at System.Text.Json.Serialization.JsonConverter`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , String& )
   at System.Text.Json.Serialization.JsonConverter`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
   Exception_EndOfInnerExceptionStack
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& , Utf8JsonReader& , Exception )
   at System.Text.Json.Serialization.JsonConverter`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
   at System.Text.Json.Serialization.JsonConverter`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ReadCoreAsObject(Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
   at System.Text.Json.JsonSerializer.ReadCore[Object](JsonConverter , Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
   at System.Text.Json.JsonSerializer.Read[Object](Utf8JsonReader& , JsonTypeInfo )
   at System.Text.Json.JsonSerializer.Deserialize(Utf8JsonReader& , Type , JsonSerializerOptions )
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.ParseArguments(JSRuntime , String , String , Type[] )
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime , DotNetInvocationInfo& , IDotNetObjectReference , String )
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime , DotNetInvocationInfo , String )

@javiercn
Copy link
Member

javiercn commented Sep 6, 2022

@coader thanks for contacting us.

Thanks for contacting us. Could you provide a minimal repro project as a public github repository as well as the steps you use to publish the project so that we could help you?

Are you configuring the linker in any way yourself?

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Sep 6, 2022
@ghost
Copy link

ghost commented Sep 6, 2022

Hi @coader. 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.

@coader
Copy link
Author

coader commented Sep 7, 2022

just a blazor project create by default template
BlazorApp1.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 Sep 7, 2022
@mkArtakMSFT mkArtakMSFT added this to the .NET 8 Planning milestone Sep 8, 2022
@ghost
Copy link

ghost commented Sep 8, 2022

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@mkArtakMSFT mkArtakMSFT added investigate and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Sep 8, 2022
@mkArtakMSFT
Copy link
Member

@coader can you please try out the latest 7.0 RC release. We know that the default project template works, so can't help you with this data. it should be something going on on your end.
If you find the culprit and you believe it's in Blazor, please file a new issue.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Oct 26, 2022
@dotnet dotnet locked as resolved and limited conversation to collaborators Nov 25, 2022
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-rendering Features dealing with how blazor renders components investigate
Projects
None yet
Development

No branches or pull requests

5 participants
@coader @javiercn @TanayParikh @mkArtakMSFT and others