Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

try-convert 0.9.4.32202 crashes with: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Could not find or load a specific file. (0x80131621) #466

Open
DkSkydancer opened this issue Jan 24, 2023 · 7 comments

Comments

@DkSkydancer
Copy link

I just installed try-convert as a global tool (dotnet tool install -g try-convert).

I changed into the root of my git repo and ran 'try-convert'. And i got this exception trace:
d:\Repos\msazure-one\Spartan>try-convert
System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Could not find or load a specific file. (0x80131621)
File name: 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.NET.StringTools.InternableString.ExpensiveConvertToString()
at Microsoft.NET.StringTools.WeakStringCache.GetOrCreateEntry(InternableString& internable, Boolean& cacheHit)
at Microsoft.NET.StringTools.WeakStringCacheInterner.Intern(InternableString& candidate, String& interned)
at Microsoft.NET.StringTools.WeakStringCacheInterner.InternableToString(InternableString& candidate)
at Microsoft.NET.StringTools.InternableString.ToString()
at Microsoft.NET.StringTools.SpanBasedStringBuilder.ToString()
at Microsoft.Build.Evaluation.Expander2.AddArgument(List1 arguments, SpanBasedStringBuilder argumentBuilder)
at Microsoft.Build.Evaluation.Expander2.ExtractFunctionArguments(IElementLocation elementLocation, String expressionFunction, String argumentsString) at Microsoft.Build.Evaluation.Expander2.Function1.ConstructFunction(IElementLocation elementLocation, String expressionFunction, Int32 argumentStartIndex, Int32 methodStartIndex, FunctionBuilder1& functionBuilder)
at Microsoft.Build.Evaluation.Expander2.Function1.ExtractPropertyFunction(String expressionFunction, IElementLocation elementLocation, Object propertyValue, UsedUninitializedProperties usedUnInitializedProperties, IFileSystem fileSystem)
at Microsoft.Build.Evaluation.Expander2.PropertyExpander1.ExpandPropertyBody(String propertyBody, Object propertyValue, IPropertyProvider1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem) at Microsoft.Build.Evaluation.Expander2.PropertyExpander1.ExpandPropertiesLeaveTypedAndEscaped(String expression, IPropertyProvider1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem, LoggingContext loggingContext)
at Microsoft.Build.Evaluation.Expander2.PropertyExpander1.ExpandPropertiesLeaveEscaped(String expression, IPropertyProvider1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem, LoggingContext loggingContext) at Microsoft.Build.Evaluation.Expander2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation, LoggingContext loggingContext)
at Microsoft.Build.Evaluation.Expander2.ExpandIntoStringAndUnescape(String expression, ExpanderOptions options, IElementLocation elementLocation, LoggingContext loggingContext) at Microsoft.Build.Evaluation.ToolsetReader.ExpandPropertyUnescaped(ToolsetPropertyDefinition property, Expander2 expander)
at Microsoft.Build.Evaluation.ToolsetReader.EvaluateAndSetProperty(ToolsetPropertyDefinition property, PropertyDictionary1 properties, PropertyDictionary1 globalProperties, PropertyDictionary1 initialProperties, Boolean accumulateProperties, String& toolsPath, String& binPath, Expander2& expander)
at Microsoft.Build.Evaluation.ToolsetReader.ReadToolset(ToolsetPropertyDefinition toolsVersion, PropertyDictionary1 globalProperties, PropertyDictionary1 initialProperties, Boolean accumulateProperties)
at Microsoft.Build.Evaluation.ToolsetReader.ReadEachToolset(Dictionary2 toolsets, PropertyDictionary1 globalProperties, PropertyDictionary1 initialProperties, Boolean accumulateProperties) at Microsoft.Build.Evaluation.ToolsetReader.ReadToolsets(Dictionary2 toolsets, PropertyDictionary1 globalProperties, PropertyDictionary1 initialProperties, Boolean accumulateProperties, String& msBuildOverrideTasksPath, String& defaultOverrideToolsVersion)
at Microsoft.Build.Evaluation.ToolsetReader.g__ReadConfigToolset|12_0(<>c__DisplayClass12_0& )
at Microsoft.Build.Evaluation.ToolsetReader.ReadAllToolsets(Dictionary2 toolsets, ToolsetRegistryReader registryReader, ToolsetConfigurationReader configurationReader, PropertyDictionary1 environmentProperties, PropertyDictionary1 globalProperties, ToolsetDefinitionLocations locations) at Microsoft.Build.Evaluation.ProjectCollection.InitializeToolsetCollection(ToolsetRegistryReader registryReader, ToolsetConfigurationReader configReader) at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary2 globalProperties, IEnumerable1 loggers, IEnumerable1 remoteLoggers, ToolsetDefinitionLocations toolsetDefinitionLocations, Int32 maxNodeCount, Boolean onlyLogCriticalEvents, Boolean loadProjectsReadOnly, Boolean useAsynchronousLogging, Boolean reuseProjectRootElementCache)
at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary2 globalProperties, IEnumerable1 loggers, IEnumerable1 remoteLoggers, ToolsetDefinitionLocations toolsetDefinitionLocations, Int32 maxNodeCount, Boolean onlyLogCriticalEvents, Boolean loadProjectsReadOnly) at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary2 globalProperties, IEnumerable1 loggers, IEnumerable1 remoteLoggers, ToolsetDefinitionLocations toolsetDefinitionLocations, Int32 maxNodeCount, Boolean onlyLogCriticalEvents)
at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary2 globalProperties, IEnumerable1 loggers, ToolsetDefinitionLocations toolsetDefinitionLocations)
at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary2 globalProperties) at Microsoft.Build.Evaluation.ProjectCollection..ctor() at MSBuild.Abstractions.MSBuildConversionWorkspace..ctor(ImmutableArray1 paths, Boolean noBackup, String tfm, Boolean keepCurrentTFMs, Boolean forceWeb) in //src/MSBuild.Abstractions/MSBuildConversionWorkspace.cs:line 24
at MSBuild.Abstractions.MSBuildConversionWorkspaceLoader.LoadWorkspace(String path, Boolean noBackup, String tfm, Boolean keepCurrentTFMs, Boolean forceWeb) in /
/src/MSBuild.Abstractions/MSBuildConversionWorkspaceLoader.cs:line 45
at MSBuild.Conversion.Program.Run(String project, String workspace, String msbuildPath, String tfm, Boolean forceWebConversion, Boolean preview, Boolean diffOnly, Boolean noBackup, Boolean keepCurrentTfms, Boolean update, Boolean mauiConversion) in /_/src/try-convert/Program.cs:line 133

@jlehman93
Copy link

I was having the same issue. I was able to get it by running by using the 5.0 sdk. I ran it with the flag -m "C:\Program Files\dotnet\sdk\5.0.408"

@ehasis
Copy link

ehasis commented Mar 1, 2023

I'm having the same issue. I don't have 5.0 SDK.

@derskythe
Copy link

Shows subject error even after make:

nuget install System.Runtime.CompilerServices.Unsafe -Version 6.0.0 -Verbosity detailed -DirectDownload

In directory of project.
Same result if I added System.Runtime.CompilerServices.Unsafe 6.0.0 directly to project and make nuget restore

@Miraak7000
Copy link

Same for me. I tried different versions of SDK .NET 6 and 7 - no success

@AdamTaylorQuilter
Copy link

I also have this issue. Using sdk v5 didn't help.

@Khaled-Damaj
Copy link

Khaled-Damaj commented May 22, 2023

I recently downloaded .NET 5 from the official Microsoft website [link: https://dotnet.microsoft.com/en-us/download/dotnet/5.0].
Please ensure that .NET 5 is installed in your dotnet\sdk folder; otherwise, the migration process will not work.
I executed the following command in the command prompt and it successfully perform the migration to .NET 6.0:
try-convert -tfm net6.0 -m "C:\Program Files\dotnet\sdk\5.0.408"

@NikoGJ
Copy link

NikoGJ commented Mar 26, 2024

Same issue with .NET 8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants