NullReferenceException on dotnet CLI commands
Closed this issue · 2 comments
rsitrifork commented
I have an issue with running dotnet commands in zsh on mac os. Any command such as dotnet restore or dotnet build results in the following:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DotNet.Cli.Utils.Muxer..ctor()
at Microsoft.DotNet.Cli.Utils.MSBuildForwardingAppWithoutLogging..ctor(IEnumerable`1 argsToForward, String msbuildPath)
at Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingApp..ctor(IEnumerable`1 argsToForward, String msbuildPath)
at Microsoft.DotNet.Tools.Restore.RestoreCommand.FromArgs(String[] args, String msbuildPath, Boolean noLogo)
at Microsoft.DotNet.Tools.Restore.RestoreCommand.Run(String[] args)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
I looked at the muxer constructor and it looks like the only candidate for a NullReference there is either Process.GetCurrentProcess() or the MainModule property on the current process.
This is my dotnet --info, which does work:
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db
.NET Core SDKs installed:
3.1.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
gokhansengun commented
Not in the position to tell why but this comment https://github.com/dotnet/cli/issues/6225#issuecomment-327918801 fixes the issue for me.
github-actions commented
Due to lack of recent activity, this issue has been labeled as 'Stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.