Skip to content
This repository has been archived by the owner. It is now read-only.

System.NullReferenceException : Object reference not set to an instance of an object. #364

Open
default-writer opened this issue Jun 23, 2018 · 1 comment

Comments

@default-writer
Copy link

System.NullReferenceException : Object reference not set to an instance of an object.
   at RefactoringEssentials.CSharp.CodeRefactorings.InitializeFieldFromConstructorParameterCodeRefactoringProvider.<>c__DisplayClass0_1.<ComputeRefactoringsAsync>b__0(CancellationToken t2)
   at RefactoringEssentials.DocumentChangeAction.GetChangedDocumentAsync(CancellationToken cancellationToken)
   at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePreviewOperationsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.GetPreviewResultAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionWithNestedFlavors.<>c__DisplayClass11_0.<GetPreviewAsync>b__0(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)

image

@gh5692
Copy link

gh5692 commented Jan 12, 2021

Also happens when trying to generate a new type

var a = await entitites.ListOfEntities
    .Where(a => a.Value == value)
    .Select(a => new NewType
    {
        Value = a.Value,
        Value2 = a.Value2,
        Value3 = a.Value3,
    })
    .SingleOrDefaultAsync()
    .ConfigureAwait(true);

as soon as the Quick Actions menu is invoked.

Project is ASP.NET, .NET Framework 4.7

System.NullReferenceException : Object reference not set to an instance of an object.
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.PropertyGenerator.UseExpressionBodyIfDesired(CodeGenerationOptions options,AccessorDeclarationSyntax declaration,ParseOptions parseOptions)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.PropertyGenerator.GenerateAccessorDeclaration(IPropertySymbol property,IMethodSymbol accessor,SyntaxKind kind,Boolean hasBody,CodeGenerationOptions options,ParseOptions parseOptions)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.PropertyGenerator.GenerateAccessorDeclaration(IPropertySymbol property,IMethodSymbol accessor,SyntaxKind kind,CodeGenerationDestination destination,CodeGenerationOptions options,ParseOptions parseOptions)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.PropertyGenerator.GenerateAccessorList(IPropertySymbol property,CodeGenerationDestination destination,CodeGenerationOptions options,ParseOptions parseOptions)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.PropertyGenerator.GeneratePropertyDeclaration(IPropertySymbol property,CodeGenerationDestination destination,CodeGenerationOptions options,ParseOptions parseOptions)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.PropertyGenerator.GeneratePropertyOrIndexer(IPropertySymbol property,CodeGenerationDestination destination,CodeGenerationOptions options,ParseOptions parseOptions)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.PropertyGenerator.AddPropertyTo(TypeDeclarationSyntax destination,IPropertySymbol property,CodeGenerationOptions options,IList`1 availableIndices)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpCodeGenerationService.AddProperty[TDeclarationNode](TDeclarationNode destination,IPropertySymbol property,CodeGenerationOptions options,IList`1 availableIndices)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.UpdateDestination[TDeclarationNode](IList`1 availableIndices,CodeGenerationOptions options,TDeclarationNode currentDestination,ISymbol member,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.AddMembersToAppropiateLocationInDestination[TDeclarationSyntax](TDeclarationSyntax destination,IEnumerable`1 members,IList`1 availableIndices,CodeGenerationOptions options,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.AddMembers[TDeclarationNode](TDeclarationNode destination,IEnumerable`1 members,IList`1 availableIndices,CodeGenerationOptions options,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.AddMembers[TDeclarationNode](TDeclarationNode destination,IEnumerable`1 members,CodeGenerationOptions options,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.NamedTypeGenerator.GenerateNamedTypeDeclaration(ICodeGenerationService service,INamedTypeSymbol namedType,CodeGenerationDestination destination,CodeGenerationOptions options,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.NamedTypeGenerator.AddNamedTypeTo(ICodeGenerationService service,NamespaceDeclarationSyntax destination,INamedTypeSymbol namedType,CodeGenerationOptions options,IList`1 availableIndices,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpCodeGenerationService.AddNamedType[TDeclarationNode](TDeclarationNode destination,INamedTypeSymbol namedType,CodeGenerationOptions options,IList`1 availableIndices,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.UpdateDestination[TDeclarationNode](IList`1 availableIndices,CodeGenerationOptions options,TDeclarationNode currentDestination,ISymbol member,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.AddMembersToAppropiateLocationInDestination[TDeclarationSyntax](TDeclarationSyntax destination,IEnumerable`1 members,IList`1 availableIndices,CodeGenerationOptions options,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.AddMembers[TDeclarationNode](TDeclarationNode destination,IEnumerable`1 members,IList`1 availableIndices,CodeGenerationOptions options,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.AddMembers[TDeclarationNode](TDeclarationNode destination,IEnumerable`1 members,CodeGenerationOptions options,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.NamespaceGenerator.GenerateNamespaceDeclaration(ICodeGenerationService service,INamespaceSymbol namespace,CodeGenerationOptions options,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.NamespaceGenerator.AddNamespaceTo(ICodeGenerationService service,CompilationUnitSyntax destination,INamespaceSymbol namespace,CodeGenerationOptions options,IList`1 availableIndices,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpCodeGenerationService.AddNamespace[TDeclarationNode](TDeclarationNode destination,INamespaceSymbol namespace,CodeGenerationOptions options,IList`1 availableIndices,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.<>c__DisplayClass53_0.<AddNamespaceAsync>b__0(SyntaxNode t,CodeGenerationOptions opts,IList`1 ai,CancellationToken ct)
   at async Microsoft.CodeAnalysis.CodeGeneration.AbstractCodeGenerationService.GetEditAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6.Editor.GetGenerateInNewFileOperationsAsync[TService,TSimpleNameSyntax,TObjectCreationExpressionSyntax,TExpressionSyntax,TTypeDeclarationSyntax,TArgumentSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6.Editor.GetOperationsAsync[TService,TSimpleNameSyntax,TObjectCreationExpressionSyntax,TExpressionSyntax,TTypeDeclarationSyntax,TArgumentSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6.GenerateTypeCodeAction.ComputeOperationsAsync[TService,TSimpleNameSyntax,TObjectCreationExpressionSyntax,TExpressionSyntax,TTypeDeclarationSyntax,TArgumentSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.GetPreviewResultAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionWithNestedFlavors.<>c__DisplayClass11_0.<GetPreviewAsync>b__0(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

image

Microsoft Visual Studio Professional 2019
Version 16.8.4
VisualStudio.16.Release/16.8.4+30907.101
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Professional

ASP.NET and Web Tools 2019 16.8.557.25636
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services 16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019 16.8.557.25636
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.8.557.25636
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 16.8.557.25636
Azure Functions and Web Jobs Tools

C# Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CodeMaid 11.2.231
CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, R, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30924.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

NuGet Package Manager 5.8.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SlowCheetah - XML config transforms 1.0
This package enables you to transform your app.config or any other XML file based on the build configuration. It also adds additional tooling to help you create XML transforms.

SQL Server Data Tools 16.0.62012.31170
Microsoft SQL Server Data Tools

TypeScript Analyzer 1.22
Provides static analysis directly in Visual Studio for TypeScript files (.ts and .tsx) using TSLint

TypeScript Tools 16.0.21016.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Spell Check Everywhere VSSpellCheckEverywhere
An extension that enables spell checking within any Visual Studio file editor or tool window that uses WPF text boxes.
https://GitHub.com/EWSoftware/VSSpellChecker

Visual Studio Spell Checker VSSpellChecker
An editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with tool windows.
https://GitHub.com/EWSoftware/VSSpellChecker

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

Yarn Installer 0.5.3
Makes it easy to restore npm packages using Yarn from within Visual Studio

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants