Skip to content

Extract Method incorrect selection expansion in Null propagation causes Assert fail followed by null ref exception at binder "SyntaxFactory.FindConditionalAccessNodeForBinding" #751

Description

@balajikris

Ported from TFS WorkItem: 1103283


Repro Steps:

  1. open VS.
  2. paste the following code..
  3. Select highlighted code and hit Ctrl + .

 

Note that this would repro only the first time in VS since this was triggered by a code action and we immediately disable faulty code actions. One needs to restart VS to repro again.

 

code:

using System;
 
class Program
{
    static void Main(string[] args)
    {
        A a = new A();
        var l = a?.Prop?.Length ?? 0;
    }
}
 
class A
{
    public B Prop { get; set; }
}
 
class B
{
    public int Length { get; set; }
}

Revisions:

  1. Created By Balaji Krishnan (1/7/2015 11:51:33 AM)

System.Exception: binding should be enclosed in a conditional access
1/7/2015 11:46:10 AM
Source:    at at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.FindConditionalAccessNodeForBinding(CSharpSyntaxNode node) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Syntax\SyntaxFactory.cs:line 1676
   at Microsoft.CodeAnalysis.CSharp.Binder.GetReceiverForConditionalBinding(ExpressionSyntax binding, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 6368
   at Microsoft.CodeAnalysis.CSharp.Binder.BindMemberBindingExpression(MemberBindingExpressionSyntax node, Boolean invoked, Boolean indexed, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 6337
   at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 457
   at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 353
   at Microsoft.CodeAnalysis.CSharp.Binder.BindValue(ExpressionSyntax node, DiagnosticBag diagnostics, BindValueKind valueKind) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 288
   at Microsoft.CodeAnalysis.CSharp.Binder.BindReturn(ReturnStatementSyntax syntax, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2813
   at Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(StatementSyntax node, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 76
   at Microsoft.CodeAnalysis.CSharp.Binder.BindBlock(BlockSyntax node, DiagnosticBag diagnostics, Binder blockBinder) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2056
   at Microsoft.CodeAnalysis.CSharp.Binder.BindBlock(BlockSyntax node, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2042
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody(MethodSymbol method, TypeCompilationState compilationState, DiagnosticBag diagnostics, Boolean generateDebugInfo, ConsList1&amp; debugImports) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 1407<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers&amp; processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 838<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol symbol) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 442<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.&lt;&gt;c__DisplayClass4.&lt;CompileNamedTypeAsTask&gt;b__5() in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 342<br>&nbsp;&nbsp; at System.Threading.Tasks.Task1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued)
   at System.Threading.Tasks.Task.WrappedTryRunInline()
   at System.Threading.Tasks.Task.InternalWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.WaitForWorkers() in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 256
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean generateDebugInfo, Boolean hasDeclarationErrors, DiagnosticBag diagnostics, Predicate1 filterOpt, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 142<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, Nullable1 span, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs:line 2050
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForSyntaxTree(CompilationStage stage, SyntaxTree syntaxTree, Nullable1 filterSpanWithinTree, Boolean includeEarlierStages, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs:line 2218<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDiagnostics(Nullable1 span, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\SyntaxTreeSemanticModel.cs:line 127
   at Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.<HasAnyErrors>d__1.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Shared\Extensions\DocumentExtensions.cs:line 101
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine&amp; stateMachine)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.HasAnyErrors(Document document, CancellationToken cancellationToken, List1 ignoreErrorCode)
   at Microsoft.CodeAnalysis.Simplification.AbstractSimplificationService3.&lt;ReduceAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Simplification\AbstractSimplificationService.cs:line 60<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.CodeAnalysis.Simplification.AbstractSimplificationService3.ReduceAsync(Document document, IEnumerable1 spans, OptionSet optionSet, IEnumerable1 reducers, CancellationToken cancellationToken)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Document document, IEnumerable1 spans, OptionSet optionSet, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Simplification\Simplifier.cs:line 117
   at Microsoft.CodeAnalysis.Simplification.Simplifier.<ReduceAsync>d__2.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Simplification\Simplifier.cs:line 99
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine&amp; stateMachine)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(Document document, SyntaxAnnotation annotation, OptionSet optionSet, CancellationToken cancellationToken)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.CodeGenerator3.<GenerateAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\MethodExtractor.CodeGenerator.cs:line 93
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine&amp; stateMachine)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.CodeGenerator3.GenerateAsync(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.CSharpCodeGenerator.<GenerateAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\CSharp\ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs:line 32
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine&amp; stateMachine)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.CSharpCodeGenerator.GenerateAsync(InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzerResult, CancellationToken cancellationToken)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.GenerateCodeAsync(InsertionPoint insertionPoint, SelectionResult selectionResult, AnalyzerResult analyzeResult, CancellationToken cancellationToken) in E:\Roslyn\Main\Closed\Features\CSharp\ExtractMethod\CSharpMethodExtractor.cs:line 73<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.&lt;ExtractMethodAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\MethodExtractor.cs:line 56<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.ExtractMethodAsync(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.ExtractMethod.AbstractExtractMethodService3.&lt;ExtractMethodAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\AbstractExtractMethodService.cs:line 39<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.CodeAnalysis.ExtractMethod.AbstractExtractMethodService3.ExtractMethodAsync(Document document, TextSpan textSpan, OptionSet options, CancellationToken cancellationToken)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.ExtractMethod.ExtractMethodService.ExtractMethodAsync(Document document, TextSpan textSpan, OptionSet options, CancellationToken cancellationToken) in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\ExtractMethodService.cs:line 13<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.&lt;GetCodeActionAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs:line 61<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.GetCodeActionAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.<ComputeRefactoringsAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs:line 46
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.ComputeRefactoringsAsync(CodeRefactoringContext context)
   at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.<GetRefactoringFromProviderAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\CodeRefactoringService.cs:line 107
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine&amp; stateMachine)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(Document document, TextSpan state, CodeRefactoringProvider provider, IExtensionManager extensionManager, CancellationToken cancellationToken)<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.&lt;&gt;c__DisplayClass12.&lt;&lt;GetRefactoringsAsync&gt;b__14&gt;d__0.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\CodeRefactoringService.cs:line 70<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.<>c__DisplayClass12.<GetRefactoringsAsync>b__14()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

StackTrace:

 

 

 

 

System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.FindConditionalAccessNodeForBinding(CSharpSyntaxNode node) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Syntax\SyntaxFactory.cs:line 1678
   at Microsoft.CodeAnalysis.CSharp.Binder.GetReceiverForConditionalBinding(ExpressionSyntax binding, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 6368
   at Microsoft.CodeAnalysis.CSharp.Binder.BindMemberBindingExpression(MemberBindingExpressionSyntax node, Boolean invoked, Boolean indexed, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 6337
   at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 457
   at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 353
   at Microsoft.CodeAnalysis.CSharp.Binder.BindValue(ExpressionSyntax node, DiagnosticBag diagnostics, BindValueKind valueKind) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 288
   at Microsoft.CodeAnalysis.CSharp.Binder.BindReturn(ReturnStatementSyntax syntax, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2813
   at Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(StatementSyntax node, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 76
   at Microsoft.CodeAnalysis.CSharp.Binder.BindBlock(BlockSyntax node, DiagnosticBag diagnostics, Binder blockBinder) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2056
   at Microsoft.CodeAnalysis.CSharp.Binder.BindBlock(BlockSyntax node, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2042
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody(MethodSymbol method, TypeCompilationState compilationState, DiagnosticBag diagnostics, Boolean generateDebugInfo, ConsList1&amp; debugImports) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 1407<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers&amp; processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 838<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol symbol) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 442<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.&lt;&gt;c__DisplayClass4.&lt;CompileNamedTypeAsTask&gt;b__5() in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 342<br>&nbsp;&nbsp; at System.Threading.Tasks.Task1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.WaitForWorkers() in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 256
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean generateDebugInfo, Boolean hasDeclarationErrors, DiagnosticBag diagnostics, Predicate1 filterOpt, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 142<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, Nullable1 span, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs:line 2050
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForSyntaxTree(CompilationStage stage, SyntaxTree syntaxTree, Nullable1 filterSpanWithinTree, Boolean includeEarlierStages, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs:line 2218<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDiagnostics(Nullable1 span, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\SyntaxTreeSemanticModel.cs:line 127
   at Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.<HasAnyErrors>d__1.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Shared\Extensions\DocumentExtensions.cs:line 101
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.Simplification.AbstractSimplificationService3.<ReduceAsync>d__1.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Simplification\AbstractSimplificationService.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.Simplification.Simplifier.&lt;ReduceAsync&gt;d__2.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Simplification\Simplifier.cs:line 99<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.CodeGenerator3.&lt;GenerateAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\MethodExtractor.CodeGenerator.cs:line 93<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.CSharpCodeGenerator.<GenerateAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\CSharp\ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs:line 32
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.&lt;ExtractMethodAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\MethodExtractor.cs:line 56<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.ExtractMethod.AbstractExtractMethodService3.&lt;ExtractMethodAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\AbstractExtractMethodService.cs:line 39<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.<GetCodeActionAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.&lt;ComputeRefactoringsAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs:line 46<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.&lt;GetRefactoringFromProviderAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\CodeRefactoringService.cs:line 108<br>1/7/2015 11:46:10 AM<br>Source: First chance exception: First chance exception: First chance exception: First chance exception: First chance exception: First chance exception: First chance exception: First chance exception: First chance exception: First chance exception: First chance exception: Microsoft.CodeAnalysis.CSharp<br>StackTrace:&nbsp;&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.FindConditionalAccessNodeForBinding(CSharpSyntaxNode node) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Syntax\SyntaxFactory.cs:line 1678<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.GetReceiverForConditionalBinding(ExpressionSyntax binding, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 6368<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.BindMemberBindingExpression(MemberBindingExpressionSyntax node, Boolean invoked, Boolean indexed, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 6337<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 457<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node, DiagnosticBag diagnostics, Boolean invoked, Boolean indexed) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 353<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.BindValue(ExpressionSyntax node, DiagnosticBag diagnostics, BindValueKind valueKind) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Expressions.cs:line 288<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.BindReturn(ReturnStatementSyntax syntax, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2813<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(StatementSyntax node, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 76<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.BindBlock(BlockSyntax node, DiagnosticBag diagnostics, Binder blockBinder) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2056<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.Binder.BindBlock(BlockSyntax node, DiagnosticBag diagnostics) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Binder\Binder_Statements.cs:line 2042<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody(MethodSymbol method, TypeCompilationState compilationState, DiagnosticBag diagnostics, Boolean generateDebugInfo, ConsList1& debugImports) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 1407
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers& processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 838
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol symbol) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 442
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass4.<CompileNamedTypeAsTask>b__5() in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 342
   at System.Threading.Tasks.Task1.InnerInvoke()<br>&nbsp;&nbsp; at System.Threading.Tasks.Task.Execute()<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.WaitForWorkers() in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 256<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean generateDebugInfo, Boolean hasDeclarationErrors, DiagnosticBag diagnostics, Predicate1 filterOpt, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 142
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, Nullable1 span, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs:line 2050<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForSyntaxTree(CompilationStage stage, SyntaxTree syntaxTree, Nullable1 filterSpanWithinTree, Boolean includeEarlierStages, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs:line 2218
   at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDiagnostics(Nullable1 span, CancellationToken cancellationToken) in E:\Roslyn\Main\Open\src\Compilers\CSharp\Portable\Compilation\SyntaxTreeSemanticModel.cs:line 127<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.&lt;HasAnyErrors&gt;d__1.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Shared\Extensions\DocumentExtensions.cs:line 101<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.Simplification.AbstractSimplificationService3.&lt;ReduceAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Simplification\AbstractSimplificationService.cs:line 60<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.Simplification.Simplifier.<ReduceAsync>d__2.MoveNext() in E:\Roslyn\Main\Open\src\Workspaces\Core\Portable\Simplification\Simplifier.cs:line 99
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.CodeGenerator3.<GenerateAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\MethodExtractor.CodeGenerator.cs:line 93
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.CSharpCodeGenerator.&lt;GenerateAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\CSharp\ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs:line 32<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.<ExtractMethodAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\MethodExtractor.cs:line 56
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.ExtractMethod.AbstractExtractMethodService3.<ExtractMethodAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\ExtractMethod\AbstractExtractMethodService.cs:line 39
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()<br>&nbsp;&nbsp; at Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.&lt;GetCodeActionAsync&gt;d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs:line 61<br>--- End of stack trace from previous location where exception was thrown ---<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<br>&nbsp;&nbsp; at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.<ComputeRefactoringsAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs:line 46
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.<GetRefactoringFromProviderAsync>d__1.MoveNext() in E:\Roslyn\Main\Closed\Features\Core\CodeRefactorings\CodeRefactoringService.cs:line 108


  1. Edited By Aleksey Tsingauz (1/7/2015 1:54:15 PM)

It looks like IDE code creates malformed syntax tree and gives it to compiler (MemberBindingExpression is used as an expression for return statement):

privatestaticglobal::BNewMethod(){return.Prop;}}

 

Here is a call stack when such node is created for the first time:

                Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax.ReturnStatementSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, Microsoft.CodeAnalysis.SyntaxNode parent, int position) Line 54138        C#

                 Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ReturnStatementSyntax.CreateRed(Microsoft.CodeAnalysis.SyntaxNode parent, int position) Line 11725  C#

                Microsoft.CodeAnalysis.dll!Microsoft.CodeAnalysis.GreenNode.CreateRed() Line 728   C#

                 Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ReturnStatement(Microsoft.CodeAnalysis.SyntaxToken returnKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, Microsoft.CodeAnalysis.SyntaxToken semicolonToken) Line 72563          C#

                 Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ReturnStatement(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression) Line 72569  C#

>                Microsoft.CodeAnalysis.CSharp.Features.dll!Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.GetInitialStatementsForMethodDefinitions() Line 111                C#

                 Microsoft.CodeAnalysis.CSharp.Features.dll!Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.CSharpCodeGenerator.CreateMethodBody(System.Threading.CancellationToken cancellationToken) Line 209        C#

                 Microsoft.CodeAnalysis.CSharp.Features.dll!Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.CSharpCodeGenerator.GenerateMethodDefinition(System.Threading.CancellationToken cancellationToken) Line 83           C#

                 Microsoft.CodeAnalysis.Features.dll!Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.CodeGenerator<Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax,Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax,Microsoft.CodeAnalysis.SyntaxNode>.GenerateAsync(System.Threading.CancellationToken cancellationToken) Line 86           C#

                 Microsoft.CodeAnalysis.CSharp.Features.dll!Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.CSharpCodeGenerator.GenerateAsync(Microsoft.CodeAnalysis.ExtractMethod.InsertionPoint insertionPoint, Microsoft.CodeAnalysis.ExtractMethod.SelectionResult selectionResult, Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.AnalyzerResult analyzerResult, System.Threading.CancellationToken cancellationToken) Line 32              C#

                 Microsoft.CodeAnalysis.CSharp.Features.dll!Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor.GenerateCodeAsync(Microsoft.CodeAnalysis.ExtractMethod.InsertionPoint insertionPoint, Microsoft.CodeAnalysis.ExtractMethod.SelectionResult selectionResult, Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.AnalyzerResult analyzeResult, System.Threading.CancellationToken cancellationToken) Line 73              C#

                 Microsoft.CodeAnalysis.Features.dll!Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.ExtractMethodAsync(System.Threading.CancellationToken cancellationToken) Line 56           C#

                 Microsoft.CodeAnalysis.Features.dll!Microsoft.CodeAnalysis.ExtractMethod.AbstractExtractMethodService<Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpSelectionValidator,Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpMethodExtractor,Microsoft.CodeAnalysis.CSharp.ExtractMethod.CSharpSelectionResult>.ExtractMethodAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, Microsoft.CodeAnalysis.Options.OptionSet options, System.Threading.CancellationToken cancellationToken) Line 39           C#

                 Microsoft.CodeAnalysis.Features.dll!Microsoft.CodeAnalysis.ExtractMethod.ExtractMethodService.ExtractMethodAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, Microsoft.CodeAnalysis.Options.OptionSet options, System.Threading.CancellationToken cancellationToken) Line 13             C#

                 Microsoft.CodeAnalysis.Features.dll!Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.GetCodeActionAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, System.Threading.CancellationToken cancellationToken) Line 61           C#

                 Microsoft.CodeAnalysis.Features.dll!Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.AbstractExtractMethodCodeRefactoringProvider.ComputeRefactoringsAsync(Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext context) Line 46                C#

                 Microsoft.CodeAnalysis.Features.dll!Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan state, Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider provider, Microsoft.CodeAnalysis.Extensions.IExtensionManager extensionManager, System.Threading.CancellationToken cancellationToken) Line 107            C#

                 Microsoft.CodeAnalysis.Features.dll!Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringsAsync() Line 70  C#

 

The same problem probably exists for ElementBindingExpression. Should check behavior for VB in similar scenarios (?., ?(), ?!).


  1. Edited By Balaji Krishnan (1/7/2015 2:10:44 PM)

Its ExtractMethod's fault then. should probably expand selection to be a?.Prop.


  1. Edited By Balaji Krishnan (1/7/2015 2:12:34 PM)

didnt intend to file in RC. clearing Triage field so that triage gets to take a look.


  1. Edited By Kevin Pilch-Bisson (2/15/2015 8:50:53 PM)

Move to GitHub


Activity

  1. self-assigned this
    on Feb 20, 2015
  2. added this to the 1.0-rc2 milestone on Feb 20, 2015
  3. changed the title [-]Assert fail followed by null ref exception at binder "SyntaxFactory.FindConditionalAccessNodeForBinding"[/-] [+]Extract Method incorrect selection expansion in Null propagation causes Assert fail followed by null ref exception at binder "SyntaxFactory.FindConditionalAccessNodeForBinding"[/+] on Mar 4, 2015
  4. added a commit that references this issue on Mar 10, 2015
    6577b5c
  5. added a commit that references this issue on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions