question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dotnet new fails: Object reference not set to an instance of an object

See original GitHub issue

Steps to reproduce

dotnet new console and dotnet new

Expected behavior

Creates a new console app / lists help for dotnet new

Actual Behavior

Getting ready...
Object reference not set to an instance of an object.
   at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save(TemplateCache cacheToSave)
   at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save()
   at Microsoft.TemplateEngine.Cli.Installer.InstallPackages(IEnumerable`1 installationRequests, IList`1 nuGetSources, Boolean debugAllowDevInstall)
   at Microsoft.TemplateEngine.Cli.Installer.InstallPackages(IEnumerable`1 installationRequests)
   at Microsoft.DotNet.Tools.New.NewCommandShim.FirstRun(IEngineEnvironmentSettings environmentSettings, IInstaller installer)
   at Microsoft.TemplateEngine.Cli.New3Command.ConfigureEnvironment()
   at Microsoft.TemplateEngine.Cli.New3Command.Initialize()
   at Microsoft.TemplateEngine.Cli.New3Command.ExecuteAsync()
   at Microsoft.TemplateEngine.Cli.CommandParsing.NewCommandInputCli.<>c__DisplayClass19_0.<<OnExecute>b__0>d.MoveNext()

Environment Data

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.100
 Commit:    cd82f021f4

Runtime Environment:
 OS Name:     opensuse-tumbleweed
 OS Version:  20191204
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.100/

Host (useful for support):
  Version: 3.1.0
  Commit:  157910edee

.NET Core SDKs installed:
  3.1.100 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Tried Fixes in Dotnet new fails: Object reference not set to an instance of an object #657

ie.

dotnet new --debug:reinit
rm -rf ~/.templateengine

Did not have this problem with dotnet sdk 2.0.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

14reactions
mdx0111commented, Dec 24, 2019

I fixed it by wiping the “/usr/share/dotnet/templates” and “~/.templateengine” folders. Then reinstalling dotnet core 3.1 and then running dotnet new --debug:reinit.

Everything works fine now.

1reaction
rescobarmcommented, Nov 26, 2020

Tenía el mismo problema con net5.0. Borré “/usr/share/dotnet/templates” como dice JorgeGomez y listo. Pero ahora me sale el siguiente error: The framework ‘Microsoft.AspNetCore.App’, version ‘5.0.0’ was not found.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve error object reference not set to an instance of ...
I work on csharp i get error object reference not set to an instance of an object code give me error var Data...
Read more >
c# - .net 6 - Object reference not set to an instance of an ...
.net 6 - Object reference not set to an instance of an object - after object instantiation, data is valid ; new PaymentList();...
Read more >
Fix: "Object Reference Not Set to an Instance of ...
The error message "Object reference not set to an instance of an object" means that perhaps you're referring to an object that doesn't...
Read more >
Get to the Bottom of C# Object Reference Not Set to an ...
So, this error description says that an object that is being called to get or set its value has no reference. This means...
Read more >
Fix “Object Reference Not Set to an Instance of an ... - YouTube
Fix “ Object Reference Not Set to an Instance of an Object ” in Microsoft Visual Studio In this post, we will show...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found