Closed joelverhagen closed 3 months ago
It's even faster to reproduce this way:
upgrade-assistant upgrade .\src\NuGet.Jobs.Auxiliary2AzureSearch\NuGet.Jobs.Auxiliary2AzureSearch.csproj --operation Inplace --targetFramework net6.0
Same exception.
I see this is tracked in our internal bug tracker (issue 2129511) and appears to be fixed in the next release.
I see this is tracked in our internal bug tracker (issue 2129511) and appears to be fixed in the next release.
What was the bug? Is it a bug in the usage of the MSBuild API? I'm seeing this on another project and would be curious on where the actual problem lies.
I don't know what the bug was. For me it went away when I updated to the latest version of the tool.
@joelverhagen which dotnet sdk version?
We are seeing the same Invalid static method invocation syntax: "[MSBuild]::SubstringByAsciiChars($(MSBuildProjectFile), 0, 8)".
in sdk 8.0.400 and 8.0.401.
I did not change my SDK version to resolve the issue, just the version of the upgrade assistent. I was on version 8.0.303
at the time (see the original issue).
Same issue here, but in a different place (when using our c# to javascript compiler). Any ideas?
[fail] [07:44:07]
##[error]H5(0,0): Error H5003: Invalid static method invocation syntax: "[MSBuild]::SubstringByAsciiChars($(MSBuildProjectFile), 0, 8)". Method '[MSBuild]::SubstringByAsciiChars' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order. /Users/runner/hostedtoolcache/dotnet/sdk/8.0.401/Microsoft.Common.CurrentVersion.targets
H5 : error H5003: Invalid static method invocation syntax: "[MSBuild]::SubstringByAsciiChars($(MSBuildProjectFile), 0, 8)". Method '[MSBuild]::SubstringByAsciiChars' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order. /Users/runner/hostedtoolcache/dotnet/sdk/8.0.401/Microsoft.Common.CurrentVersion.targets [/Users/runner/work/1/s/FrontEnd/Mosaik.FrontEnd.Core/Mosaik.FrontEnd.Core.csproj]
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at H5.Compiler.CompilationProcessor.Compile(CompilationRequest compilationRequest, UID128 compilationUID, CancellationToken cancellationToken)
at H5.Compiler.Program.Main(String[] args)
at H5.Compiler.Program.<Main>(String[] args)
I don't know what the bug was. For me it went away when I updated to the latest version of the tool.
Can you check the internal bug tracker issue you reference to find out? It sounds like the API usage changed to work around this issue in the upgrade-assistant rather than the root cause being fixed?
Information on how upgrade-assistant worked around this could be useful so we could make similar changes to fix or work around the issue.
I will defer to the upgrade assistant team for the details. I am only a user of upgrade assistant. The internal bug does not mention the fix made. It looks like the problem was retested on the latest build and it went away. But maybe other conversation happened that I don't know about.
I will pass this conversation on to someone internally who may be able to help.
@joelverhagen the issue is also happening outside of the upgrade assistant - should I open a new issue on GitHub for that?
@abpiskunov - is this something you could help with?
@theolivenbaum The issue was caused by mismatch in msbuild assembly UA loaded and what targets of the project being upgraded were containing - new .NET targets needed that method, when msbuild assembly loaded already was old and did not have it. For UA you could just update it to newer version. For other tools, please open bugs in their repos.
I get this same error trying to use Code Analysis and MSBuild to read a solution.
@abpiskunov "by mismatch in msbuild assembly UA loaded and what targets of the project being upgraded were containing - new .NET targets needed that method" Could you please make it detail?
I meet the same issue when I call the method LoadProject of Microsoft.Build.Evaluation.ProjectCollection. I build the App that use LoadProject to open a csproj file. It throws above exception when I run that app in a machine which upgraded to VS2022 Preview (which support Net9.0)
upgrade-assistant.clef
that is produced in the working directoryNone was produced. But here are the selected options:
Describe the bug
I would like to try migrating NuGet/NuGet.Jobs repository using
upgrade-assistant
. I opted to use the CLI since it seems like an easier way to start. I plan on using the tool just to migrate to SDK-based projects first (reverting anet6.0
TFM tonet472
). But I wasn't able to get that far. The tool failed with anInvalidProjectFileException
when runninganalyze
.To Reproduce
dev
upgrade-assistant analyze
in the repo rootApplication sources (source code, settings and binary dependencies)
.NET 6.0 (Supported until November, 2024)
Select all
Source code and settings
n
Save as HTML
UpToNet6
Unrestricted
y
This runs for a while:
It then shows the exception.
Exceptions (if any)
Further technical details
dotnet --list-sdks
upgrade-assistant --version