Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@monojenkins
Copy link
Contributor

Fixes #19466

It was discovered that the specified cast is not valid was being thrown because of an attempt to cast an object of type ResourceType as XmlDictionaryString. However, ResourceType is of type Enum, so instead a check for type XmlDictionaryString is performed before resorting to getting the object's name via ToString().

To test code changes, I needed to side install msbuild into my mono install via
make -j in <msbuild_repo>
<msbuild_repo>/install-mono-prefix.sh <local-mono-install>
And then in the Wasm project directory
<local-mono-install>/bin/msbuild Wasm.csproj

Steps to reproduce:

$ dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3
$ dotnet new blazorwasm -o Wasm
$ cd Wasm
$ msbuild Wasm.csproj

output before

"/Users/mdhwang/Wasm/Wasm.csproj" (default target) (1) ->
(_GenerateBlazorBootJson target) ->
  /Users/mdhwang/.nuget/packages/microsoft.aspnetcore.components.webassembly.build/3.2.0-preview3.20168.3/targets/Blazor.MonoRuntime.targets(348,5): error : Specified cast is not valid. [/Users/mdhwang/Wasm/Wasm.csproj]

    0 Warning(s)
    1 Error(s)

Output after code changes

Wasm (Blazor output) -> /Users/mdhwang/Wasm/bin/Debug/netstandard2.1/wwwroot
Done Building Project "/Users/mdhwang/Wasm/Wasm.csproj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Backport of #19620.

/cc @steveisok @mdh1418

@akoeplinger
Copy link
Member

@monojenkins build failed

@akoeplinger akoeplinger merged commit 83558de into mono:2020-02 Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants