CodeConverter icon indicating copy to clipboard operation
CodeConverter copied to clipboard

CodeConverter support on Mac/Linux?

Open coolbluewater opened this issue 3 years ago • 11 comments

I'm able to build with Visual Studio for Mac after installing the correct runtime, but there are a number of unit test failures of type PlatformNotSupportedException. The Web project also crashes with an exception indicating that named memory maps are not supported.

Which leads me to the question - which platforms are supported for running CodeConverter on? Be nice if those were listed in the readme.

coolbluewater avatar Aug 28 '20 16:08 coolbluewater

You're the first person to ask! I don't have a mac so it's not been tested. I'd be happy to work with you on seeing if we can make it supported though.

As for Linux, I haven't got around to testing the command line there yet. Possibly if I tried to get that working it'd cover many of the things needed for mac too.

For now I'll pin the issue so people can see it. After a bit of investigation we can add details to the readme.

GrahamTheCoder avatar Aug 29 '20 08:08 GrahamTheCoder

I've just tested this on a brand new kali linux install within WSL. Trying to convert a brand new helloworld vb console app I got type load when it tried to open the solution:

System.TypeLoadException   at Microsoft.Build.Execution.BuildManager.BeginBuild(BuildParameters parameters)
   at Microsoft.CodeAnalysis.MSBuild.Build.ProjectBuildManager.StartBatchBuild(IDictionary`2 globalProperties)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadAsync(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(String solutionFilePath, IProgress`1 progress, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(String solutionFilePath, IProgress`1 progress, CancellationToken cancellationToken)
   at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.GetSolutionAsync(String projectOrSolutionFile, IProgress`1 progress) in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\MSBuildWorkspaceConverter.cs:line 76
   at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.<>c__DisplayClass7_0.<<ConvertProjectsWhereAsync>b__1>d.MoveNext() in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\MSBuildWorkspaceConverter.cs:line 49
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Threading.AwaitExtensions.ExecuteContinuationSynchronouslyAwaiter`1.GetResult()
   at Microsoft.VisualStudio.Threading.AsyncLazy`1.<>c__DisplayClass13_0.<<GetValueAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.ConvertProjectsWhereAsync(Func`2 shouldConvertProject, Nullable`1 targetLanguage, IProgress`1 progress, CancellationToken token)+MoveNext() in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\MSBuildWorkspaceConverter.cs:line 51
   at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.ConvertProjectsWhereAsync(Func`2 shouldConvertProject, Nullable`1 targetLanguage, IProgress`1 progress, CancellationToken token)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator`1.MoveNextCore() in d:\a\1\s\Ix.NET\Source\System.Linq.Async\System\Linq\Operators\Where.cs:line 197
   at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in d:\a\1\s\Ix.NET\Source\System.Linq.Async\System\Linq\AsyncIterator.cs:line 70
   at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in d:\a\1\s\Ix.NET\Source\System.Linq.Async\System\Linq\AsyncIterator.cs:line 75
   at ICSharpCode.CodeConverter.CommandLine.ConversionResultWriter.WriteConvertedAsync(IAsyncEnumerable`1 conversionResultsEnumerable, String solutionFilePath, DirectoryInfo targetDirectory, Boolean wipeTargetDirectory, Boolean copyOriginalDirectory, IProgress`1 progress, CancellationToken cancellationToken) in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\ConversionResultWriter.cs:line 42
   at ICSharpCode.CodeConverter.CommandLine.ConversionResultWriter.WriteConvertedAsync(IAsyncEnumerable`1 conversionResultsEnumerable, String solutionFilePath, DirectoryInfo targetDirectory, Boolean wipeTargetDirectory, Boolean copyOriginalDirectory, IProgress`1 progress, CancellationToken cancellationToken) in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\ConversionResultWriter.cs:line 42
   at ICSharpCode.CodeConverter.CommandLine.CodeConvProgram.ConvertAsync(IProgress`1 progress, CancellationToken cancellationToken) in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\CodeConvProgram.cs:line 142
   at ICSharpCode.CodeConverter.CommandLine.CodeConvProgram.ExecuteAsync() in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\CodeConvProgram.cs:line 86

Could not load type 'Microsoft.Build.Eventing.MSBuildEventSource' from assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Please report issues at github.com/icsharpcode/CodeConverter

The first thing to verify would be whether an MSBuild instance can be registered and was located in https://github.com/icsharpcode/CodeConverter/blob/4d7b4411c07ab9fd13d1047cbb8b97197322a2f6/CommandLine/CodeConv.Shared/MSBuildWorkspaceConverter.cs#L115-L123 This is very likely solvable by using the correct assembly binding redirects, but interop with MSBuild has so far been incredibly complicated and painful so I'm not going to rush into that until I have a decent chunk of time to spend on it.

Really minor issue in comparison: The git status detection seems to always detect changes, so the force parameter is needed.

GrahamTheCoder avatar Aug 31 '20 13:08 GrahamTheCoder

Hi, I mentioned Linux out of curiosity, am primarily interested in getting it to work on the Mac. There are 25 unit test failures. As a baseline, how many fail on Windows?

Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.VB.MultiFileSolutionAndProjectTests.ConvertWholeSolutionAsync ...
System.PlatformNotSupportedException : Operation is not supported on this platform.Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.VB.MultiFileSolutionAndProjectTests.ConvertCSharpConsoleAppOnlyAsync ...
System.PlatformNotSupportedException : Operation is not supported on this platform.Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.MultiFileSolutionAndProjectTests.ConvertVbLibraryOnlyAsync ...
System.PlatformNotSupportedException : Operation is not supported on this platform.Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.MultiFileSolutionAndProjectTests.ConvertWholeSolutionAsync ...
System.PlatformNotSupportedException : Operation is not supported on this platform.Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
}Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.VB.StatementTests.ObjectInitializationStatementInDeclarationAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.VB.StatementTests.ObjectInitializationStatementInVarDeclarationAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.VB.StatementTests.ObjectInitializationStatementAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.MemberTests.PropertyMemberTests.TestParameterizedPropertyAndGenericInvocationAndEnumEdgeCasesAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.TypeCastTests.TestSingleCharacterStringLiteralBecomesCharWhenNeededAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.StatementTests.StatementTests.ObjectInitializationStatementAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.StatementTests.StatementTests.ObjectInitializationStatementInDeclarationAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.StatementTests.StatementTests.ObjectInitializationStatementInVarDeclarationAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 Running CodeConverter.Tests.ICSharpCode.CodeConverter.Tests.CSharp.SelfVerifyingTests.VisualBasicToCSharpAsync ...

The first failure I believe is due to a platform incompatibility:

System.PlatformNotSupportedException : Operation is not supported on this platform.
Stack trace:
  at Microsoft.Build.Shared.BuildEnvironmentHelper.get_Instance () [0x00017] in <30335e8b8945436fbad975615dfe18bf>:0 
  at Microsoft.Build.Utilities.Traits.get_Instance () [0x00000] in <30335e8b8945436fbad975615dfe18bf>:0 
  at Microsoft.Build.Evaluation.ProjectCollection..ctor (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.Collections.Generic.IEnumerable`1[T] loggers, System.Collections.Generic.IEnumerable`1[T] remoteLoggers, Microsoft.Build.Evaluation.ToolsetDefinitionLocations toolsetDefinitionLocations, System.Int32 maxNodeCount, System.Boolean onlyLogCriticalEvents, System.Boolean loadProjectsReadOnly) [0x0003e] in <30335e8b8945436fbad975615dfe18bf>:0 
  at Microsoft.Build.Evaluation.ProjectCollection..ctor (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.Collections.Generic.IEnumerable`1[T] loggers, System.Collections.Generic.IEnumerable`1[T] remoteLoggers, Microsoft.Build.Evaluation.ToolsetDefinitionLocations toolsetDefinitionLocations, System.Int32 maxNodeCount, System.Boolean onlyLogCriticalEvents) [0x00000] in <30335e8b8945436fbad975615dfe18bf>:0 
  at Microsoft.Build.Evaluation.ProjectCollection..ctor (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.Collections.Generic.IEnumerable`1[T] loggers, Microsoft.Build.Evaluation.ToolsetDefinitionLocations toolsetDefinitionLocations) [0x00000] in <30335e8b8945436fbad975615dfe18bf>:0 
  at Microsoft.Build.Evaluation.ProjectCollection..ctor (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties) [0x00000] in <30335e8b8945436fbad975615dfe18bf>:0 
  at Microsoft.CodeAnalysis.MSBuild.Build.ProjectBuildManager.StartBatchBuild (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties) [0x00026] in <4d27b64f655d4459aa8eda2c750f7e9a>:0 
  at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader+Worker.LoadAsync (System.Threading.CancellationToken cancellationToken) [0x0002c] in <4d27b64f655d4459aa8eda2c750f7e9a>:0 
  at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync (System.String solutionFilePath, System.IProgress`1[T] progress, System.Threading.CancellationToken cancellationToken) [0x001aa] in <4d27b64f655d4459aa8eda2c750f7e9a>:0 
  at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync (System.String solutionFilePath, System.IProgress`1[T] progress, System.Threading.CancellationToken cancellationToken) [0x0009f] in <4d27b64f655d4459aa8eda2c750f7e9a>:0 
  at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.GetSolutionAsync (System.String projectOrSolutionFile, System.IProgress`1[T] progress) [0x001cc] in <25632ba29f2e47d0b44eba199ff48521>:0 
  at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter+<>c__DisplayClass7_0.<ConvertProjectsWhereAsync>b__1 () [0x00088] in <25632ba29f2e47d0b44eba199ff48521>:0 
  at Microsoft.VisualStudio.Threading.AwaitExtensions+ExecuteContinuationSynchronouslyAwaiter`1[T].GetResult () [0x0000c] in <9cab5751d7694956b77710b019a05f95>:0 
  at Microsoft.VisualStudio.Threading.AsyncLazy`1+<>c__DisplayClass13_0[T].<GetValueAsync>b__0 () [0x000d8] in <9cab5751d7694956b77710b019a05f95>:0 
  at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter+<ConvertProjectsWhereAsync>d__7.MoveNext () [0x00146] in <25632ba29f2e47d0b44eba199ff48521>:0 
  at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1[TResult].GetResult (System.Int16 token) [0x0001f] in <91d5fec11917455db31ac2cbefcf2ada>:0 
  at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter+<ConvertProjectsWhereAsync>d__7.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult (System.Int16 token) [0x00000] in <25632ba29f2e47d0b44eba199ff48521>:0 
  at System.Collections.Generic.AsyncEnumerableHelpers.ToArrayWithLength[T] (System.Collections.Generic.IAsyncEnumerable`1[T] source, System.Threading.CancellationToken cancellationToken) [0x00102] in <9b0f44533d0d4998afa003efec898402>:0 
  at System.Collections.Generic.AsyncEnumerableHelpers.ToArrayWithLength[T] (System.Collections.Generic.IAsyncEnumerable`1[T] source, System.Threading.CancellationToken cancellationToken) [0x002dd] in <9b0f44533d0d4998afa003efec898402>:0 
  at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter[TResult].GetResult () [0x00000] in <1bdef6d938b04a419446ac9b7afe0768>:0 
  at System.Collections.Generic.AsyncEnumerableHelpers.ToArray[T] (System.Collections.Generic.IAsyncEnumerable`1[T] source, System.Threading.CancellationToken cancellationToken) [0x00074] in <9b0f44533d0d4998afa003efec898402>:0 
  at ICSharpCode.CodeConverter.Tests.TestRunners.MultiFileTestFixture.ConvertProjectsWhereAsync (System.Func`2[T,TResult] shouldConvertProject, ICSharpCode.CodeConverter.Language targetLanguage, System.String expectedResultsDirectory) [0x000b5] in <f760c836eeb145acbc2b52de3fdb73e1>:0 
  at ICSharpCode.CodeConverter.Tests.VB.MultiFileSolutionAndProjectTests.ConvertWholeSolutionAsync () [0x00093] in <f760c836eeb145acbc2b52de3fdb73e1>:0 

I'm going to investigate this one a bit more.

coolbluewater avatar Sep 05 '20 11:09 coolbluewater

Looks like the latter exception is identical to https://github.com/dotnet/msbuild/issues/2554, which is a currently open bug :(

coolbluewater avatar Sep 05 '20 12:09 coolbluewater

Thanks for the extra info. I think you should be able to see windows test results here (linked from the readme via the green badge) https://icsharpcode.visualstudio.com/icsharpcode-pipelines/_build/results?buildId=1627&view=ms.vss-test-web.build-test-results-tab

Total tests: 681 (676 Passed, 0 Failed, 5 Others) I.e. All not marked as "skipped" pass on windows.

One obvious place things could break is in path separators, but the exception you mentioned does sound more severe than that and as you say probably msbuild level issue. However, the vs extension is the one part that doesn't rely on msbuild, so it may still work. Are you able to install that on visual studio for mac and let me know what exceptions occur? Thanks!

GrahamTheCoder avatar Sep 07 '20 08:09 GrahamTheCoder

I've just tested this on a brand new kali linux install within WSL. Trying to convert a brand new helloworld vb console app I got type load when it tried to open the solution:

System.TypeLoadException   at Microsoft.Build.Execution.BuildManager.BeginBuild(BuildParameters parameters)
   at Microsoft.CodeAnalysis.MSBuild.Build.ProjectBuildManager.StartBatchBuild(IDictionary`2 globalProperties)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadAsync(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(String solutionFilePath, IProgress`1 progress, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(String solutionFilePath, IProgress`1 progress, CancellationToken cancellationToken)
   at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.GetSolutionAsync(String projectOrSolutionFile, IProgress`1 progress) in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\MSBuildWorkspaceConverter.cs:line 76
   at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.<>c__DisplayClass7_0.<<ConvertProjectsWhereAsync>b__1>d.MoveNext() in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\MSBuildWorkspaceConverter.cs:line 49
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Threading.AwaitExtensions.ExecuteContinuationSynchronouslyAwaiter`1.GetResult()
   at Microsoft.VisualStudio.Threading.AsyncLazy`1.<>c__DisplayClass13_0.<<GetValueAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.ConvertProjectsWhereAsync(Func`2 shouldConvertProject, Nullable`1 targetLanguage, IProgress`1 progress, CancellationToken token)+MoveNext() in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\MSBuildWorkspaceConverter.cs:line 51
   at ICSharpCode.CodeConverter.CommandLine.MSBuildWorkspaceConverter.ConvertProjectsWhereAsync(Func`2 shouldConvertProject, Nullable`1 targetLanguage, IProgress`1 progress, CancellationToken token)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator`1.MoveNextCore() in d:\a\1\s\Ix.NET\Source\System.Linq.Async\System\Linq\Operators\Where.cs:line 197
   at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in d:\a\1\s\Ix.NET\Source\System.Linq.Async\System\Linq\AsyncIterator.cs:line 70
   at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in d:\a\1\s\Ix.NET\Source\System.Linq.Async\System\Linq\AsyncIterator.cs:line 75
   at ICSharpCode.CodeConverter.CommandLine.ConversionResultWriter.WriteConvertedAsync(IAsyncEnumerable`1 conversionResultsEnumerable, String solutionFilePath, DirectoryInfo targetDirectory, Boolean wipeTargetDirectory, Boolean copyOriginalDirectory, IProgress`1 progress, CancellationToken cancellationToken) in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\ConversionResultWriter.cs:line 42
   at ICSharpCode.CodeConverter.CommandLine.ConversionResultWriter.WriteConvertedAsync(IAsyncEnumerable`1 conversionResultsEnumerable, String solutionFilePath, DirectoryInfo targetDirectory, Boolean wipeTargetDirectory, Boolean copyOriginalDirectory, IProgress`1 progress, CancellationToken cancellationToken) in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\ConversionResultWriter.cs:line 42
   at ICSharpCode.CodeConverter.CommandLine.CodeConvProgram.ConvertAsync(IProgress`1 progress, CancellationToken cancellationToken) in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\CodeConvProgram.cs:line 142
   at ICSharpCode.CodeConverter.CommandLine.CodeConvProgram.ExecuteAsync() in D:\GitWorkspace\CodeConverter\CommandLine\CodeConv.Shared\CodeConvProgram.cs:line 86

Could not load type 'Microsoft.Build.Eventing.MSBuildEventSource' from assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Please report issues at github.com/icsharpcode/CodeConverter

The first thing to verify would be whether an MSBuild instance can be registered and was located in https://github.com/icsharpcode/CodeConverter/blob/4d7b4411c07ab9fd13d1047cbb8b97197322a2f6/CommandLine/CodeConv.Shared/MSBuildWorkspaceConverter.cs#L115-L123

This is very likely solvable by using the correct assembly binding redirects, but interop with MSBuild has so far been incredibly complicated and painful so I'm not going to rush into that until I have a decent chunk of time to spend on it. Really minor issue in comparison: The git status detection seems to always detect changes, so the force parameter is needed.

FYI I got this error on windows when running the tool codeconv without Visual Studio installed. After installing Visual Studio it ran, but asked me to fix a lot of compiler errors. Only after installing the VS extension and converting the project in the IDE did it work successfully. Maybe Visual Studio should be listed as a prerequisite for using the tool?

NickLydon avatar Feb 18 '21 18:02 NickLydon

Good point. It definitely relies on msbuild minimum. But I haven't tried with only that, nor documented it as a requirement 👍

GrahamTheCoder avatar Feb 18 '21 22:02 GrahamTheCoder

I have Visual Studio 2015 installed and just got this error on my windows machine.

Could not load type 'Microsoft.Build.Eventing.MSBuildEventSource' from assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Please report issues at github.com/icsharpcode/CodeConverter

Is Visual Studio 2017+ required for this?

JavaScriptDude avatar Dec 19 '21 21:12 JavaScriptDude

Yes, 2017 is the absolute minimum (and even that has had issues for some machines without recent dot net runtime installed) . It's configured not to install on prior versions so I'm curious how you managed to get to that point? Really though you're by far best off using the latest version of VS that can load your projects, ideally VS2022

GrahamTheCoder avatar Dec 20 '21 09:12 GrahamTheCoder

Ah, did you get that error from running the command line perhaps? That just tries to use the latest installed version of VS and msbuild assemblies

GrahamTheCoder avatar Dec 20 '21 09:12 GrahamTheCoder

I ran from command-line. Plugin was blocked from VS 2015 as designed . I have since upgraded to VS 2022 and it works great from there.

Thanks for the quick reply.

JavaScriptDude avatar Dec 20 '21 15:12 JavaScriptDude