java.interop
java.interop copied to clipboard
Replace Mono.CSharp+Mono.Terminal with jonsequitur/dotnet-repl
tools/logcat-parse currently uses the Mono.CSharp and Mono.Terminal NuGet packages.
The Mono.CSharp NuGet package only targets net45. It is not compatible with .NET 6, and even though logcat-parse is multi-targeted to .NET 6.0 and no immediately relevant warnings are emitted, it doesn't run under .NET 6:
% dotnet bin/Debug-net6.0/logcat-parse.dll
…
Unhandled exception. System.MissingMethodException: Method not found: 'System.Reflection.Emit.AssemblyBuilder System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String)'.
at Mono.CSharp.AssemblyDefinitionDynamic.Create(AppDomain domain, AssemblyBuilderAccess access)
at Mono.CSharp.Evaluator.CompileBlock(Class host, Undo undo, Report Report)
at Mono.CSharp.Evaluator.Compile(String input, CompiledMethod& compiled)
at Mono.CSharp.Evaluator.Evaluate(String input, Object& result, Boolean& result_set)
at Mono.CSharp.Evaluator.Run(String statement)
at Xamarin.Android.Tools.LogcatParse.Program.Main(String[] args) in …/Java.Interop/tools/logcat-parse/Program.cs:line 47
We should look into replacing Mono.CSharp (and Mono.Terminal?) with https://github.com/jonsequitur/dotnet-repl / ".NET Interactive", on the hope/assumption that dotnet-repl works under .NET 6.
We explicitly suppressed the warning in logcat-parse.csproj. 😁
<PackageReference Include="Mono.CSharp" NoWarn="NU1701" />