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

RuntimeConfigParserTask fails in .NET framework MSBuild #55277

Closed
jonathanpeppers opened this issue Jul 7, 2021 · 4 comments · Fixed by #56152
Closed

RuntimeConfigParserTask fails in .NET framework MSBuild #55277

jonathanpeppers opened this issue Jul 7, 2021 · 4 comments · Fixed by #56152
Assignees
Milestone

Comments

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Jul 7, 2021

Description

This would fail inside VS Windows, but you can repro by doing:

  • dotnet new android
  • "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\MSBuild.exe" -restore
    or
  • "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe" -restore

Fails with:

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\30.0.100-preview.6.62\targets\Microsoft.Android.Sdk.RuntimeConfig.targets(36,5): error MSB4018: The "RuntimeConfigParserTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at RuntimeConfigParserTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

This works fine if you use dotnet build instead of using .NET framework.

Configuration

> dotnet --version
6.0.100-preview.6.21355.2

Regression?

I'm not sure if .NET framework MSBuild worked before or not.

Other information

Here is are .binlog files using MSBuild.exe from VS 2022 and VS 2019:

logs.zip

/cc @steveisok

@dotnet-issue-labeler dotnet-issue-labeler bot added area-Infrastructure-libraries untriaged New issue has not been triaged by the area owner labels Jul 7, 2021
@ghost
Copy link

ghost commented Jul 7, 2021

Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

This would inside VS Windows, but you can repro by doing:

  • dotnet new android
  • "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\MSBuild.exe" -restore
    or
  • "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe" -restore

Fails with:

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\30.0.100-preview.6.62\targets\Microsoft.Android.Sdk.RuntimeConfig.targets(36,5): error MSB4018: The "RuntimeConfigParserTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at RuntimeConfigParserTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

This works fine if you use dotnet build instead of using .NET framework.

Configuration

> dotnet --version
6.0.100-preview.6.21355.2

Regression?

I'm not sure if .NET framework MSBuild worked before or not.

Other information

Here is are .binlog files using MSBuild.exe from VS 2022 and VS 2019:

logs.zip

/cc @steveisok

Author: jonathanpeppers
Assignees: -
Labels:

area-Infrastructure-libraries, untriaged

Milestone: -

@steveisok steveisok added this to the 6.0.0 milestone Jul 7, 2021
@safern
Copy link
Member

safern commented Jul 7, 2021

@steveisok this looks more like mono infra, rather than libraries infra?

@steveisok
Copy link
Member

@akoeplinger Can you please look into this?

@jeffschwMSFT jeffschwMSFT removed the untriaged New issue has not been triaged by the area owner label Jul 9, 2021
@lambdageek
Copy link
Member

On .NET Framework, S.R.M should come from nuget. https://www.nuget.org/packages/System.Reflection.Metadata/5.0.0
We probably needs some PrivateAssets thing in the .csproj for framework.

That said, another way to fix this is to stop using BlobBuilder for writing length-prefixed UTF8 strings.

builder.WriteCompressedInteger(count);
foreach (var kvp in properties)
{
builder.WriteSerializedString(kvp.Key);
builder.WriteSerializedString(kvp.Value);
}

The tricky bit is that the length uses the ECMA value-based compression (values < 255 take 1 byte, otherwise 2 bytes or 4 bytes) which we'd need to re-implement ourselves. But it should be simple.

directhex added a commit to directhex/runtime that referenced this issue Jul 22, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 22, 2021
steveisok pushed a commit that referenced this issue Jul 23, 2021
…onfigParser task. (#56152)

This change adds an explicit dependency on System.Reflection.Metadata to the RuntimeConfigParser task when targeting the full .net framework.

Closes: #55277
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 23, 2021
github-actions bot pushed a commit that referenced this issue Jul 23, 2021
mmitche pushed a commit that referenced this issue Jul 23, 2021
…etadata to RuntimeConfigParser task (#56216)

* Add explicit dep on SRM to MonoTargets.

Closes: #55277

* Guard dependency so it's not there on net6

* Changes suggested by @steveisok

Co-authored-by: Jo Shields <joshield@microsoft.com>
@ghost ghost locked as resolved and limited conversation to collaborators Aug 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants