Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roslyn crashes with 'KeyNotFoundException' when completion is invoked after a local fun declaration #17814

Closed
VladimirReshetnikov opened this issue Mar 13, 2017 · 3 comments
Assignees
Milestone

Comments

@VladimirReshetnikov
Copy link

VladimirReshetnikov commented Mar 13, 2017

Version Used:
Microsoft Visual Studio Community 2017
Version 15.0.26228.4 D15RTWSVC
Microsoft .NET Framework
Version 4.6.01586

Steps to Reproduce:

  1. Create a C# project in Visual Studio 17
  2. Paste the following code:
class C {
  static void foo()
  {
     void f<[X]T>(){}

  }
}
  1. Put the caret at the empty line following the local function f declaration and press Ctrl+Space

Expected Behavior: No crash

Actual Behavior: Visual Studio crashes with System.Collections.Generic.KeyNotFoundException "The given key was not present in the dictionary."

	System.Collections.Immutable.dll!System.Collections.Immutable.ImmutableDictionary<Microsoft.CodeAnalysis.SyntaxTree, int>.this[Microsoft.CodeAnalysis.SyntaxTree].get(Microsoft.CodeAnalysis.SyntaxTree key)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetSyntaxTreeOrdinal(Microsoft.CodeAnalysis.SyntaxTree tree)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetBinderFactory(Microsoft.CodeAnalysis.SyntaxTree syntaxTree = {Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.ParsedSyntaxTree})	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Symbol.GetAttributesToBind(Roslyn.Utilities.OneOrMany<Microsoft.CodeAnalysis.SyntaxList<Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax>> attributeDeclarationSyntaxLists, Microsoft.CodeAnalysis.CSharp.Symbols.AttributeLocation symbolPart = None, Microsoft.CodeAnalysis.DiagnosticBag diagnostics = Count = 0, Microsoft.CodeAnalysis.CSharp.CSharpCompilation compilation = {Microsoft.CodeAnalysis.CSharp.CSharpCompilation}, Microsoft.CodeAnalysis.CSharp.Binder rootBinderOpt = null, out System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CSharp.Binder> binders = Uninitialized)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Symbol.LoadAndValidateAttributes(Roslyn.Utilities.OneOrMany<Microsoft.CodeAnalysis.SyntaxList<Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax>> attributesSyntaxLists, ref Microsoft.CodeAnalysis.CustomAttributesBag<Microsoft.CodeAnalysis.CSharp.Symbols.CSharpAttributeData> lazyCustomAttributesBag = null, Microsoft.CodeAnalysis.CSharp.Symbols.AttributeLocation symbolPart = None, bool earlyDecodingOnly = false, Microsoft.CodeAnalysis.DiagnosticBag addToDiagnostics = Count = 0, Microsoft.CodeAnalysis.CSharp.Binder binderOpt)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Symbols.SourceTypeParameterSymbolBase.GetAttributesBag(Microsoft.CodeAnalysis.DiagnosticBag diagnosticsOpt)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Symbols.LocalFunctionSymbol.GetDeclarationDiagnostics(Microsoft.CodeAnalysis.DiagnosticBag addTo = Count = 0)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Binder.BindLocalFunctionStatement(Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax node = LocalFunctionStatementSyntax LocalFunctionStatement void f<[X]T>() { }, Microsoft.CodeAnalysis.DiagnosticBag diagnostics)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MemberSemanticModel.IncrementalBinder.BindStatement(Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Binder.BindBlockParts(Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax node = BlockSyntax Block { void f<[X]T>() { } }, Microsoft.CodeAnalysis.DiagnosticBag diagnostics = Count = 0)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MemberSemanticModel.IncrementalBinder.BindStatement(Microsoft.CodeAnalysis.CSharp.Syntax.StatementSyntax node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.Bind(Microsoft.CodeAnalysis.CSharp.Binder binder, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodBodySemanticModel.Bind(Microsoft.CodeAnalysis.CSharp.Binder binder, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode node, Microsoft.CodeAnalysis.DiagnosticBag diagnostics)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MemberSemanticModel.GetBoundNodes(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode node = LocalFunctionStatementSyntax LocalFunctionStatement void f<[X]T>() { })	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MemberSemanticModel.GetLowerBoundNode(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode node)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MemberSemanticModel.GetBoundNodes(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode node, out Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode bindableNode = IdentifierNameSyntax IdentifierName X, out Microsoft.CodeAnalysis.CSharp.BoundNode lowestBoundNode = null, out Microsoft.CodeAnalysis.CSharp.BoundNode highestBoundNode = null, out Microsoft.CodeAnalysis.CSharp.BoundNode boundParent = null)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MemberSemanticModel.GetSymbolInfoWorker(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode node, Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.SymbolInfoOptions options = DefaultOptions, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetSymbolInfo(Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetSymbolInfo(Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.CSharp.Workspaces.dll!Microsoft.CodeAnalysis.CSharp.Classification.Classifiers.NameSyntaxClassifier.ClassifyTypeSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.NameSyntax name = IdentifierNameSyntax IdentifierName X, Microsoft.CodeAnalysis.SemanticModel semanticModel = {Microsoft.CodeAnalysis.CSharp.MethodBodySemanticModel}, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.CSharp.Workspaces.dll!Microsoft.CodeAnalysis.CSharp.Classification.Classifiers.NameSyntaxClassifier.ClassifyNode(Microsoft.CodeAnalysis.SyntaxNode syntax, Microsoft.CodeAnalysis.SemanticModel semanticModel, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.Classification.AbstractClassificationService.Worker.ClassifyNode(Microsoft.CodeAnalysis.SyntaxNode syntax = IdentifierNameSyntax IdentifierName X)	Unknown
 	Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.Classification.AbstractClassificationService.Worker.ProcessNodes()	Unknown
 	Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.Classification.AbstractClassificationService.Worker.Classify(Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Text.TextSpan textSpan, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.ClassifiedSpan> list, System.Func<Microsoft.CodeAnalysis.SyntaxNode, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.Classifiers.ISyntaxClassifier>> getNodeClassifiers, System.Func<Microsoft.CodeAnalysis.SyntaxToken, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.Classifiers.ISyntaxClassifier>> getTokenClassifiers, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.Classification.AbstractClassificationService.AddSemanticClassificationsAsync(Microsoft.CodeAnalysis.Document document = Program.cs, Microsoft.CodeAnalysis.Text.TextSpan textSpan = {Microsoft.CodeAnalysis.Text.TextSpan}, System.Func<Microsoft.CodeAnalysis.SyntaxNode, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.Classifiers.ISyntaxClassifier>> getNodeClassifiers = IsCancellationRequested = false, System.Func<Microsoft.CodeAnalysis.SyntaxToken, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.Classifiers.ISyntaxClassifier>> getTokenClassifiers = {Method = {System.Reflection.RuntimeMethodInfo}}, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.ClassifiedSpan> result = {Method = {System.Reflection.RuntimeMethodInfo}}, System.Threading.CancellationToken cancellationToken = Count = 0)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.CodeAnalysis.Classification.AbstractClassificationService.<AddSemanticClassificationsAsync>d__5>(ref Microsoft.CodeAnalysis.Classification.AbstractClassificationService.<AddSemanticClassificationsAsync>d__5 stateMachine)	Unknown
 	Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.Classification.AbstractClassificationService.AddSemanticClassificationsAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, System.Func<Microsoft.CodeAnalysis.SyntaxNode, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.Classifiers.ISyntaxClassifier>> getNodeClassifiers, System.Func<Microsoft.CodeAnalysis.SyntaxToken, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.Classifiers.ISyntaxClassifier>> getTokenClassifiers, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.ClassifiedSpan> result, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Classification.AbstractEditorClassificationService.AddSemanticClassificationsAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, System.Collections.Generic.List<Microsoft.CodeAnalysis.Classification.ClassifiedSpan> result, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.ClassifySpansAsync(Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag> context = {Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan}, Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan spanToTag = {Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>}, Microsoft.CodeAnalysis.Editor.IEditorClassificationService classificationService = {Microsoft.CodeAnalysis.Editor.CSharp.Classification.CSharpEditorClassificationService}, Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap typeMap = {Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap})	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.<ClassifySpansAsync>d__2>(ref Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.<ClassifySpansAsync>d__2 stateMachine)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.ClassifySpansAsync(Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag> context, Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan spanToTag, Microsoft.CodeAnalysis.Editor.IEditorClassificationService classificationService, Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap typeMap)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.TryClassifyContainingMemberSpan(Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag> context = {Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>}, Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan spanToTag = {Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan}, Microsoft.CodeAnalysis.Editor.IEditorClassificationService classificationService = {Microsoft.CodeAnalysis.Editor.CSharp.Classification.CSharpEditorClassificationService}, Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap typeMap = {Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap})	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<bool>.Start<Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.<TryClassifyContainingMemberSpan>d__1>(ref Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.<TryClassifyContainingMemberSpan>d__1 stateMachine)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.TryClassifyContainingMemberSpan(Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag> context, Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan spanToTag, Microsoft.CodeAnalysis.Editor.IEditorClassificationService classificationService, Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap typeMap)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.ProduceTagsAsync(Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag> context = {Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan}, Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan spanToTag = {Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>}, Microsoft.CodeAnalysis.Editor.IEditorClassificationService classificationService = {Microsoft.CodeAnalysis.Editor.CSharp.Classification.CSharpEditorClassificationService}, Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap typeMap = {Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap})	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.<ProduceTagsAsync>d__0>(ref Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.<ProduceTagsAsync>d__0 stateMachine)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationUtilities.ProduceTagsAsync(Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag> context, Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan spanToTag, Microsoft.CodeAnalysis.Editor.IEditorClassificationService classificationService, Microsoft.CodeAnalysis.Editor.Shared.Utilities.ClassificationTypeMap typeMap)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Classification.SemanticClassificationViewTaggerProvider.ProduceTagsAsync(Microsoft.CodeAnalysis.Editor.Tagging.TaggerContext<Microsoft.VisualStudio.Text.Tagging.IClassificationTag> context)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Tagging.AbstractAsynchronousTaggerProvider<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>.TagSource.RecomputeTagsAsync(object oldState = IsCancellationRequested = false, Microsoft.VisualStudio.Text.SnapshotPoint? caretPosition = {Microsoft.CodeAnalysis.VersionStamp}, Microsoft.CodeAnalysis.Text.TextChangeRange? textChangeRange = Count = 1, System.Collections.Generic.List<Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan> spansToTag = {Microsoft.VisualStudio.Text.SnapshotPoint}, System.Collections.Immutable.ImmutableDictionary<Microsoft.VisualStudio.Text.ITextBuffer, Microsoft.CodeAnalysis.Editor.Shared.Tagging.TagSpanIntervalTree<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>> oldTagTrees = {Microsoft.CodeAnalysis.Text.TextChangeRange}, System.Threading.CancellationToken cancellationToken = Count = 1)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.CodeAnalysis.Editor.Tagging.AbstractAsynchronousTaggerProvider<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>.TagSource.<RecomputeTagsAsync>d__83>(ref Microsoft.CodeAnalysis.Editor.Tagging.AbstractAsynchronousTaggerProvider<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>.TagSource.<RecomputeTagsAsync>d__83 stateMachine)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Tagging.AbstractAsynchronousTaggerProvider<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>.TagSource.RecomputeTagsAsync(object oldState, Microsoft.VisualStudio.Text.SnapshotPoint? caretPosition, Microsoft.CodeAnalysis.Text.TextChangeRange? textChangeRange, System.Collections.Generic.List<Microsoft.CodeAnalysis.Editor.DocumentSnapshotSpan> spansToTag, System.Collections.Immutable.ImmutableDictionary<Microsoft.VisualStudio.Text.ITextBuffer, Microsoft.CodeAnalysis.Editor.Shared.Tagging.TagSpanIntervalTree<Microsoft.VisualStudio.Text.Tagging.IClassificationTag>> oldTagTrees, System.Threading.CancellationToken cancellationToken)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Tagging.AbstractAsynchronousTaggerProvider<System.__Canon>.TagSource.RecomputeTagsForeground.AnonymousMethod__0(System.Threading.CancellationToken ct)	Unknown
 	Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Shared.Threading.AsynchronousSerialWorkQueue.EnqueueBackgroundTask.AnonymousMethod__0(System.Threading.Tasks.Task _)	Unknown
 	mscorlib.dll!System.Threading.Tasks.ContinuationResultTaskFromTask<System.Threading.Tasks.Task>.InnerInvoke()	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.Execute()	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot = Id = 24707, Status = Running, Method = "System.Threading.Tasks.Task <EnqueueBackgroundTask>b__0(System.Threading.Tasks.Task)", Result = "{Not yet computed}")	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()	Unknown
 	mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()	Unknown
 	mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()	Unknown
@jcouv
Copy link
Member

jcouv commented Mar 14, 2017

FYI @agocke

@jcouv jcouv added the Feature - Local Functions Local Functions label Mar 17, 2017
@jcouv jcouv added this to the 15.3 milestone Mar 17, 2017
@jaredpar
Copy link
Member

@jaredpar jaredpar added the Bug label May 30, 2017
@agocke agocke modified the milestones: 15.6, 15.3 Jun 6, 2017
@agocke
Copy link
Member

agocke commented Jun 23, 2017

Notes: Briefly debugged through this. Looks like type parameters in local functions have to be added to the semantic model.

@jcouv jcouv modified the milestones: 15.5, 15.later Sep 29, 2017
agocke added a commit to agocke/roslyn that referenced this issue Jan 8, 2018
This looks like simple oversight. The binder being used for type
parameters was retrieved from the binder factory since we didn't
explicitly pass one. For members this is correct since the binder
factory can be queried for top-level binders. This is not correct for
local functions because they use method body binders, which are not
accessible from the binder factory.

Mostly, this doesn't matter. The exception is when you try to
speculatively bind an attribute on a type parameter. Here, you need an
in-method binder and VS will crash if it's the wrong binder. This was
uncommon since attributes on type parameters are not permitted in local
functions, but VS should not crash.

Fixes dotnet#17814
@VSadov VSadov closed this as completed in 0a54c5a Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants