Open WhiteBlackGoose opened 3 years ago
This issue persists in the latest (1.0.0-beta.22175.2) version as well, although the error has moved slightly, it remains in ResolveRefAssemblies
.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DotNet.Interactive.CSharp.InteractiveWorkspace.TryParseVersion(String versionString, Version& v)
at Microsoft.DotNet.Interactive.CSharp.InteractiveWorkspace.ResolveRefAssemblyPath()
at Microsoft.DotNet.Interactive.CSharp.InteractiveWorkspace.ResolveRefAssemblies()
at Microsoft.DotNet.Interactive.CSharp.InteractiveWorkspace..ctor()
at Microsoft.DotNet.Interactive.CSharp.CSharpKernel..ctor(String name)
at Microsoft.DotNet.Interactive.CSharp.CSharpKernel..ctor()
ie. Currently its not possible to use this package when in 'self-contained' mode.
We don't currently plan to make these libraries trimmable and many of their dependencies are not yet trimmable.
If the API allowed the user to supply the MetaDataReference
's, like the CSharpCompilation.CreateScriptCompilation
API, it could probably work in single file mode. Although it is still not pretty.
See: https://github.com/dotnet/roslyn/issues/50719 and https://github.com/andersstorhaug/SingleFileScripting
Describe the bug
I use
Microsoft.DotNet.Interactive.CSharp
in the app anddotnet publish
it. For repro I made a dummy app which just runs the user's code.Command:
Program.cs
```cs using Microsoft.DotNet.Interactive.CSharp; using Microsoft.DotNet.Interactive; using Microsoft.DotNet.Interactive.Commands; using Microsoft.DotNet.Interactive.Events; using Microsoft.DotNet.Interactive.Formatting; Formatter.SetPreferredMimeTypeFor(typeof(object), "text/plain"); var kernel = new CSharpKernel(); var currInput = 0; while (true) { var currInputLocal = currInput; var code = ReadBlock("Your input", currInputLocal); var computed = await kernel.SendAsync(new SubmitCode(code)); computed.KernelEvents.Subscribe(e => { switch (e) { case (CommandSucceeded s): WriteBlock("Outcome", currInputLocal, "Success"); break; case (DisplayEvent display): WriteBlock("Result", currInputLocal, display.FormattedValues.First().Value); break; case (CommandFailed failed): WriteBlock("Error", currInputLocal, failed.Message); break; } }); currInput++; } static void WriteBlock(string prefix, int id, string text) { Console.WriteLine(); Console.Write($"{prefix} [{id}]: "); Console.Write(text); Console.WriteLine(); } static string ReadBlock(string prefix, int id) { Console.WriteLine(); Console.Write($"{prefix} [{id}]: "); var text = Console.ReadLine(); Console.WriteLine(); return text; } ```hw.csproj
```xmlSingle file
When publishing in single file, I get
(see Bug 1 in the csproj file from above)
Trimmed mode
And that's what I get for trimmed mode (link)
(fuck exception localisation. It says "missing required member for the compiler")
(see bug 2 in the csproj file)