mono / monodevelop

MonoDevelop is a cross platform .NET IDE
http://www.monodevelop.com
2.84k stars 1.02k forks source link

CSharpAddImportCodeFixProvider error with C# file opened without a project #7293

Open mrward opened 5 years ago

mrward commented 5 years ago

Open a C# file on its own into the IDE. Then move the caret to a class that is defined in another file.

See the infobar show an error about the CSharpAddImportCodeFixProvider.

The code fix provider calls into the PackageInstallerService and the NuGet addin tries to load the settings for a solution when none is open.

Build Information Release ID: 800002632 Git revision: 92055ad490dda43cac9bfe2afaa43fa8cd11bcbe Build date: 2019-03-02 01:17:07+00 Build branch: master Xamarin extensions: 7570e231690c79a09e121d99c47be744ac2409c9

Roslyn error: Extension_Exception CSharpAddImportCodeFixProvider : Object reference not set to an instance of an object
  at MonoDevelop.PackageManagement.MonoDevelopSolutionManager.LoadSettings () [0x00000] in /Users/vsts/agent/2.148.0/work/1/s/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopSolutionManager.cs:163 
  at MonoDevelop.PackageManagement.MonoDevelopSolutionManager..ctor (MonoDevelop.Projects.Solution solution) [0x00013] in /Users/vsts/agent/2.148.0/work/1/s/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopSolutionManager.cs:55 
  at MonoDevelop.PackageManagement.MonoDevelopSolutionManager..ctor (MonoDevelop.PackageManagement.ISolution solution) [0x00000] in /Users/vsts/agent/2.148.0/work/1/s/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopSolutionManager.cs:47 
  at MonoDevelop.PackageManagement.PackageManagementWorkspace.GetSolutionManager (MonoDevelop.PackageManagement.ISolution solution) [0x0002a] in /Users/vsts/agent/2.148.0/work/1/s/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementWorkspace.cs:121 
  at MonoDevelop.PackageManagement.PackageManagementWorkspace.GetSolutionManager (MonoDevelop.Projects.Solution solution) [0x00000] in /Users/vsts/agent/2.148.0/work/1/s/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementWorkspace.cs:105 
  at MonoDevelop.PackageManagement.Refactoring.NuGetPackageServicesProxy.GetSourceRepositories () [0x00000] in /Users/vsts/agent/2.148.0/work/1/s/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Refactoring/NuGetPackageServicesProxy.cs:194 
  at MonoDevelop.PackageManagement.Refactoring.NuGetPackageServicesProxy.GetSources (System.Boolean includeUnOfficial, System.Boolean includeDisabled) [0x00006] in /Users/vsts/agent/2.148.0/work/1/s/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Refactoring/NuGetPackageServicesProxy.cs:73 
  at MonoDevelop.Refactoring.PackageInstaller.PackageInstallerServiceFactory+PackageInstallerService.get_PackageSources () [0x00000] in /Users/vsts/agent/2.148.0/work/1/s/monodevelop/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.PackageInstaller/PackageInstallerService.cs:107 
  at Microsoft.CodeAnalysis.AddImport.AbstractAddImportCodeFixProvider.RegisterCodeFixesAsync (Microsoft.CodeAnalysis.CodeFixes.CodeFixContext context) [0x000e6] in /_/src/Features/Core/Portable/AddImport/AbstractAddImportCodeFixProvider.cs:52 
  at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.GetCodeFixesAsync (Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan span, Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider fixer, System.Collections.Immutable.ImmutableArray`1[T] diagnostics, System.Threading.CancellationToken cancellationToken) [0x00094] in /_/src/EditorFeatures/Core/Implementation/CodeFixes/CodeFixService.cs:348 
  at Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T] (Microsoft.CodeAnalysis.Extensions.IExtensionManager extensionManager, System.Object extension, System.Func`1[TResult] function, T defaultValue) [0x00043] in /_/src/Workspaces/Core/Portable/ExtensionManager/IExtensionManagerExtensions.cs:95 
Therzok commented 5 years ago

Is this after a solution is closed? I can't imagine it happen on startup

Therzok commented 5 years ago

Ah, nevermind, this is misc files workspace