waf / CSharpRepl

A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
https://fuqua.io/CSharpRepl/
Mozilla Public License 2.0
2.95k stars 112 forks source link

Could not load file or assembly NuGet.Common #380

Closed Suiram1701 closed 2 months ago

Suiram1701 commented 3 months ago

Version

0.6.7

What happened?

I installed it and everything worked fine and now (two weeks later) an exception appears on start.

One or more errors occurred. (Could not load file or assembly 'NuGet.Common, Version=6.9.1.3, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.)
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'NuGet.Common, Version=6.9.1.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
File name: 'NuGet.Common, Version=6.9.1.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at CSharpRepl.Services.Nuget.NugetPackageInstaller..ctor(IConsoleEx console, Configuration configuration)
   at CSharpRepl.Services.Roslyn.MetadataResolvers.NugetPackageMetadataResolver..ctor(IConsoleEx console, Configuration configuration) in /_/CSharpRepl.Services/Roslyn/MetadataResolvers/NugetPackageMetadataResolver.cs:line 25
   at CSharpRepl.Services.Roslyn.Scripting.ScriptRunner..ctor(WorkspaceManager workspaceManager, CSharpCompilationOptions compilationOptions, AssemblyReferenceService referenceAssemblyService, IConsoleEx console, Configuration configuration) in /_/CSharpRepl.Services/Roslyn/Scripting/ScriptRunner.cs:line 50
   at CSharpRepl.Services.Roslyn.RoslynServices.<>c__DisplayClass20_1.<.ctor>b__1() in /_/CSharpRepl.Services/Roslyn/RoslynServices.cs:line 94
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at CSharpRepl.Services.Roslyn.RoslynServices.ShouldOpenCompletionWindowAsync(String text, Int32 caret, KeyPress keyPress, CancellationToken cancellationToken) in /_/CSharpRepl.Services/Roslyn/RoslynServices.cs:line 259
   at PrettyPrompt.Panes.CompletionPane.PrettyPrompt.Consoles.IKeyPressHandler.OnKeyUp(KeyPress key, CancellationToken cancellationToken)
   at PrettyPrompt.Prompt.<>c__DisplayClass9_0.<<ReadLineAsync>g__InterpretKeyPress|0>d.MoveNext()
--- End of stack trace from previous location ---
   at PrettyPrompt.Prompt.ReadLineAsync()
   at CSharpRepl.ReadEvalPrintLoop.RunAsync(Configuration config) in /_/CSharpRepl/ReadEvalPrintLoop.cs:line 51
   at CSharpRepl.Program.Main(String[] args) in /_/CSharpRepl/Program.cs:line 71
   at CSharpRepl.Program.Main(String[] args) in /_/CSharpRepl/Program.cs:line 77
   at CSharpRepl.Program.<Main>(String[] args)

I tried to reinstall the tool but it didn't' work. This is the tracelog:

2024-08-17T09:28:31 - Trace session starting
2024-08-17T09:28:31 - Starting background initialization
2024-08-17T09:28:31 - ERROR: No instances of MSBuild could be detected.
Try calling RegisterInstance or RegisterMSBuildPath to manually register one.
2024-08-17T09:28:31 - Available Reference Assemblies: "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref": ["8.0.7", "9.0.0-preview.7.24405.7"]
2024-08-17T09:28:31 - Available Implementation Assemblies: "C:\Program Files\dotnet\shared\Microsoft.NETCore.App": ["6.0.32", "8.0.7", "9.0.0-preview.7.24405.7"]
2024-08-17T09:28:31 - .NET Version: Microsoft.NETCore.App / 8.0.7
2024-08-17T09:28:31 - Reference Assembly Paths: C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\8.0.7\ref\net8.0
2024-08-17T09:28:31 - Implementation Assembly Paths: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.7
2024-08-17T09:28:31 - Shared Framework Paths: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.7
2024-08-17T09:28:31 - Loaded Reference Assemblies: "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\8.0.7\ref\net8.0": ["System.Diagnostics.Tools.dll", "System.IO.FileSystem.Primitives.dll", "System.Linq.Queryable.dll", "System.Net.Primitives.dll", "System.Net.WebSockets.dll", "System.Security.Cryptography.Primitives.dll", "System.Text.Encoding.Extensions.dll", "System.Threading.Tasks.Parallel.dll", "System.Diagnostics.TraceSource.dll", "System.IO.FileSystem.Watcher.dll", "System.Memory.dll", "System.Net.Quic.dll", "System.Numerics.dll", "System.Security.Cryptography.X509Certificates.dll", "System.Text.Encodings.Web.dll", "System.Threading.Thread.dll", "System.Diagnostics.Tracing.dll", "System.IO.IsolatedStorage.dll", "System.Net.dll", "System.Net.Requests.dll", "System.Numerics.Vectors.dll", "System.Security.dll", "System.Text.Json.dll", "System.Threading.ThreadPool.dll", "System.dll", "System.IO.MemoryMappedFiles.dll", "System.Net.Http.dll", "System.Net.Security.dll", "System.ObjectModel.dll", "System.Security.Principal.dll", "System.Text.RegularExpressions.dll", "System.Threading.Timer.dll", "System.Drawing.dll", "System.IO.Pipes.AccessControl.dll", "System.Net.Http.Json.dll", "System.Net.ServicePoint.dll", "System.Reflection.DispatchProxy.dll", "System.Security.Principal.Windows.dll", "System.Threading.Channels.dll", "System.Transactions.dll", "System.Drawing.Primitives.dll", "System.IO.Pipes.dll", "System.Net.HttpListener.dll", "System.Net.Sockets.dll", "System.Reflection.dll", "System.Security.SecureString.dll", "System.Threading.dll", "System.Transactions.Local.dll", "System.Dynamic.Runtime.dll", "System.IO.UnmanagedMemoryStream.dll", "System.Net.Mail.dll", "System.Net.WebClient.dll", "System.Reflection.Emit.dll", "System.ServiceModel.Web.dll", "System.Threading.Overlapped.dll", "System.ValueTuple.dll", "System.Formats.Asn1.dll", "System.Linq.dll", "System.Net.NameResolution.dll", "System.Net.WebHeaderCollection.dll", "System.Reflection.Emit.ILGeneration.dll", "System.ServiceProcess.dll", "System.Threading.Tasks.Dataflow.dll", "System.Web.dll", "System.Formats.Tar.dll", "System.Linq.Expressions.dll", "System.Net.NetworkInformation.dll", "System.Net.WebProxy.dll", "System.Reflection.Emit.Lightweight.dll", "System.Text.Encoding.CodePages.dll", "System.Threading.Tasks.dll", "System.Web.HttpUtility.dll", "System.Globalization.Calendars.dll", "System.Linq.Parallel.dll", "System.Net.Ping.dll", "System.Net.WebSockets.Client.dll", "System.Reflection.Extensions.dll", "System.Text.Encoding.dll", "System.Threading.Tasks.Extensions.dll", "System.Windows.dll", "System.Globalization.dll", "System.Globalization.Extensions.dll", "System.IO.Compression.Brotli.dll", "System.IO.Compression.dll", "System.IO.Compression.FileSystem.dll", "System.IO.Compression.ZipFile.dll", "System.IO.dll", "System.IO.FileSystem.AccessControl.dll", "System.IO.FileSystem.dll", "System.IO.FileSystem.DriveInfo.dll", "System.Runtime.Handles.dll", "System.Runtime.InteropServices.dll", "System.Runtime.InteropServices.JavaScript.dll", "System.Runtime.InteropServices.RuntimeInformation.dll", "System.Runtime.Intrinsics.dll", "System.Runtime.Loader.dll", "System.Runtime.Numerics.dll", "System.Runtime.Serialization.dll", "System.Runtime.Serialization.Formatters.dll", "System.Runtime.Serialization.Json.dll", "System.Reflection.Metadata.dll", "System.Reflection.Primitives.dll", "System.Reflection.TypeExtensions.dll", "System.Resources.Reader.dll", "System.Resources.ResourceManager.dll", "System.Resources.Writer.dll", "System.Runtime.CompilerServices.Unsafe.dll", "System.Runtime.CompilerServices.VisualC.dll", "System.Runtime.dll", "System.Runtime.Extensions.dll", "Microsoft.CSharp.dll", "Microsoft.VisualBasic.Core.dll", "Microsoft.VisualBasic.dll", "Microsoft.Win32.Primitives.dll", "Microsoft.Win32.Registry.dll", "mscorlib.dll", "netstandard.dll", "System.AppContext.dll", "System.Buffers.dll", "System.Collections.Concurrent.dll", "System.Collections.dll", "System.Runtime.Serialization.Primitives.dll", "System.Runtime.Serialization.Xml.dll", "System.Security.AccessControl.dll", "System.Security.Claims.dll", "System.Security.Cryptography.Algorithms.dll", "System.Security.Cryptography.Cng.dll", "System.Security.Cryptography.Csp.dll", "System.Security.Cryptography.dll", "System.Security.Cryptography.Encoding.dll", "System.Security.Cryptography.OpenSsl.dll", "System.Collections.Immutable.dll", "System.Collections.NonGeneric.dll", "System.Collections.Specialized.dll", "System.ComponentModel.Annotations.dll", "System.ComponentModel.DataAnnotations.dll", "System.ComponentModel.dll", "System.ComponentModel.EventBasedAsync.dll", "System.ComponentModel.Primitives.dll", "System.ComponentModel.TypeConverter.dll", "System.Configuration.dll", "System.Console.dll", "System.Core.dll", "System.Data.Common.dll", "System.Data.DataSetExtensions.dll", "System.Data.dll", "System.Diagnostics.Contracts.dll", "System.Diagnostics.Debug.dll", "System.Diagnostics.DiagnosticSource.dll", "System.Diagnostics.FileVersionInfo.dll", "System.Diagnostics.Process.dll", "System.Diagnostics.StackTrace.dll", "System.Diagnostics.TextWriterTraceListener.dll", "System.Xml.dll", "System.Xml.Linq.dll", "System.Xml.ReaderWriter.dll", "System.Xml.Serialization.dll", "System.Xml.XDocument.dll", "System.Xml.XmlDocument.dll", "System.Xml.XmlSerializer.dll", "System.Xml.XPath.dll", "System.Xml.XPath.XDocument.dll", "WindowsBase.dll"]
2024-08-17T09:28:31 - Loaded Implementation Assemblies: "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.7": ["System.Resources.ResourceManager.dll", "System.Resources.Writer.dll", "System.Runtime.CompilerServices.Unsafe.dll", "System.Runtime.CompilerServices.VisualC.dll", "System.Runtime.dll", "System.Runtime.Extensions.dll", "System.Runtime.Handles.dll", "System.Runtime.InteropServices.dll", "System.Runtime.InteropServices.JavaScript.dll", "System.Runtime.InteropServices.RuntimeInformation.dll", "System.Runtime.Intrinsics.dll", "System.Threading.Tasks.dll", "System.Threading.Tasks.Extensions.dll", "System.Threading.Tasks.Parallel.dll", "System.Threading.Thread.dll", "System.Threading.ThreadPool.dll", "System.Threading.Timer.dll", "System.Transactions.dll", "System.Transactions.Local.dll", "System.ValueTuple.dll", "System.Web.dll", "System.Web.HttpUtility.dll", "System.Drawing.dll", "System.Drawing.Primitives.dll", "System.Dynamic.Runtime.dll", "System.Formats.Asn1.dll", "System.Formats.Tar.dll", "System.Globalization.Calendars.dll", "System.Globalization.dll", "System.Globalization.Extensions.dll", "System.IO.Compression.Brotli.dll", "System.IO.Compression.dll", "System.IO.Compression.FileSystem.dll", "System.Private.Xml.Linq.dll", "System.Reflection.DispatchProxy.dll", "System.Reflection.dll", "System.Reflection.Emit.dll", "System.Reflection.Emit.ILGeneration.dll", "System.Reflection.Emit.Lightweight.dll", "System.Reflection.Extensions.dll", "System.Reflection.Metadata.dll", "System.Reflection.Primitives.dll", "System.Reflection.TypeExtensions.dll", "System.Resources.Reader.dll", "System.Runtime.Loader.dll", "System.Runtime.Numerics.dll", "System.Runtime.Serialization.dll", "System.Runtime.Serialization.Formatters.dll", "System.Runtime.Serialization.Json.dll", "System.Runtime.Serialization.Primitives.dll", "System.Runtime.Serialization.Xml.dll", "System.Security.AccessControl.dll", "System.Security.Claims.dll", "System.Security.Cryptography.Algorithms.dll", "System.Security.Cryptography.Cng.dll", "System.Security.Cryptography.Csp.dll", "System.Security.Cryptography.dll", "System.Security.Cryptography.Encoding.dll", "System.Security.Cryptography.OpenSsl.dll", "System.Security.Cryptography.Primitives.dll", "System.Security.Cryptography.X509Certificates.dll", "System.Security.dll", "System.Security.Principal.dll", "System.Security.Principal.Windows.dll", "System.Security.SecureString.dll", "System.ServiceModel.Web.dll", "Microsoft.CSharp.dll", "Microsoft.VisualBasic.Core.dll", "Microsoft.VisualBasic.dll", "Microsoft.Win32.Primitives.dll", "Microsoft.Win32.Registry.dll", "System.Data.dll", "System.Diagnostics.Contracts.dll", "System.Diagnostics.Debug.dll", "System.Diagnostics.DiagnosticSource.dll", "System.Diagnostics.FileVersionInfo.dll", "System.Diagnostics.Process.dll", "System.Diagnostics.StackTrace.dll", "System.Diagnostics.TextWriterTraceListener.dll", "System.Diagnostics.Tools.dll", "System.Diagnostics.TraceSource.dll", "System.Diagnostics.Tracing.dll", "System.dll", "System.IO.Compression.ZipFile.dll", "System.IO.dll", "System.IO.FileSystem.AccessControl.dll", "System.IO.FileSystem.dll", "System.IO.FileSystem.DriveInfo.dll", "System.IO.FileSystem.Primitives.dll", "System.IO.FileSystem.Watcher.dll", "System.IO.IsolatedStorage.dll", "System.IO.MemoryMappedFiles.dll", "System.IO.Pipes.AccessControl.dll", "System.Net.Mail.dll", "System.Net.NameResolution.dll", "System.Net.NetworkInformation.dll", "System.Net.Ping.dll", "System.Net.Primitives.dll", "System.Net.Quic.dll", "System.Net.Requests.dll", "System.Net.Security.dll", "System.Net.ServicePoint.dll", "System.Net.Sockets.dll", "System.Net.WebClient.dll", "System.Collections.Specialized.dll", "System.ComponentModel.Annotations.dll", "System.ComponentModel.DataAnnotations.dll", "System.ComponentModel.dll", "System.ComponentModel.EventBasedAsync.dll", "System.ComponentModel.Primitives.dll", "System.ComponentModel.TypeConverter.dll", "System.Configuration.dll", "mscorlib.dll", "System.Console.dll", "System.Core.dll", "System.Data.Common.dll", "netstandard.dll", "System.Data.DataSetExtensions.dll", "System.AppContext.dll", "System.Buffers.dll", "System.Collections.Concurrent.dll", "System.Collections.dll", "System.Collections.Immutable.dll", "System.Collections.NonGeneric.dll", "System.ServiceProcess.dll", "System.Text.Encoding.CodePages.dll", "System.Text.Encoding.dll", "System.Text.Encoding.Extensions.dll", "System.Text.Encodings.Web.dll", "System.Text.Json.dll", "System.Text.RegularExpressions.dll", "System.Threading.Channels.dll", "System.Threading.dll", "System.Threading.Overlapped.dll", "System.Threading.Tasks.Dataflow.dll", "System.Windows.dll", "System.Xml.dll", "System.Xml.Linq.dll", "System.Xml.ReaderWriter.dll", "System.Xml.Serialization.dll", "System.Xml.XDocument.dll", "System.Xml.XmlDocument.dll", "System.Xml.XmlSerializer.dll", "System.Xml.XPath.dll", "System.Xml.XPath.XDocument.dll", "WindowsBase.dll", "System.IO.Pipes.dll", "System.IO.UnmanagedMemoryStream.dll", "System.Linq.dll", "System.Linq.Expressions.dll", "System.Linq.Parallel.dll", "System.Linq.Queryable.dll", "System.Memory.dll", "System.Net.dll", "System.Net.Http.dll", "System.Net.Http.Json.dll", "System.Net.HttpListener.dll", "System.Net.WebHeaderCollection.dll", "System.Net.WebProxy.dll", "System.Net.WebSockets.Client.dll", "System.Net.WebSockets.dll", "System.Numerics.dll", "System.Numerics.Vectors.dll", "System.ObjectModel.dll", "System.Private.CoreLib.dll", "System.Private.DataContractSerialization.dll", "System.Private.Uri.dll", "System.Private.Xml.dll"]
2024-08-17T09:28:32 - MEF Default Assemblies: C:\Users\mariu\.dotnet\tools\.store\csharprepl\0.6.7\csharprepl\0.6.7\tools\net8.0\any\Microsoft.CodeAnalysis.Workspaces.dll, C:\Users\mariu\.dotnet\tools\.store\csharprepl\0.6.7\csharprepl\0.6.7\tools\net8.0\any\Microsoft.CodeAnalysis.CSharp.Workspaces.dll, C:\Users\mariu\.dotnet\tools\.store\csharprepl\0.6.7\csharprepl\0.6.7\tools\net8.0\any\Microsoft.CodeAnalysis.Features.dll, C:\Users\mariu\.dotnet\tools\.store\csharprepl\0.6.7\csharprepl\0.6.7\tools\net8.0\any\Microsoft.CodeAnalysis.CSharp.Features.dll
st3l10s commented 2 months ago

I had the same issue. Solved it by installing dotnet 8 SDK

Suiram1701 commented 2 months ago

@st3l10s Thanks for the advice. It worked.

waf commented 2 months ago

Thanks @st3l10s for helping out! We definitely need better error messages here. I'll investigate this.