Closed NoahStahl closed 3 years ago
Hi @NoahStahl Thanks for reporting this issue. I've just released a fixed version 1.17.437 Could you update to the newest version and let me know if the issue is gone?
Thanks for the quick reply! I installed the update and now see a different error, below.
I can reproduce with the following. Error occurs as soon as StartsWith()
is entered.
string test = "test";
test.StartsWith()
System.ArgumentException: Syntax node is not within syntax tree at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.CheckSyntaxNode(CSharpSyntaxNode syntax)at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetTypeInfo(ExpressionSyntax expression, CancellationToken cancellationToken)at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetTypeInfoFromNode(SyntaxNode node, CancellationToken cancellationToken)at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetTypeInfoCore(SyntaxNode node, CancellationToken cancellationToken)at MappingGenerator.RoslynHelpers.SemanticModelExtensions.GetTypeForSymbol(SemanticModel semanticModel, ISymbol symbol)at MappingGenerator.Mappings.SourceFinders.LocalScopeMappingSourceFinder.<>cDisplayClass9_0.
b1(ISymbol x)at System.Linq.Enumerable.WhereListIterator 0(ImmutableArray1.MoveNext()at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)at MappingGenerator.Mappings.SourceFinders.LocalScopeMappingSourceFinder.FindMappingSource(String targetName, AnnotatedType targetType, MappingContext mappingContext)at MappingGenerator.MethodHelpers.MethodHelper.FindArgumentsMatch(ImmutableArray`1 parameters, IMappingSourceFinder mappingSourceFinder, MappingContext mappingContext)at MappingGenerator.MethodHelpers.MethodHelper.<>cDisplayClass0_0.b 1 x)at System.Linq.Enumerable.WhereSelectListIterator
2.MoveNext()at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()at System.Linq.Buffer
1..ctor(IEnumerable1 source)at System.Linq.OrderedEnumerable
1.d1.MoveNext()at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable 1 source)at MappingGenerator.MethodHelpers.MethodHelper.FindBestParametersMatch(IMappingSourceFinder mappingSourceFinder, IEnumerable
1 overloadParameterSets, MappingContext mappingContext)at MappingGenerator.Features.Suggestions.MethodParametersSuggestionProvider.GetArgumentListWithLocalVariables(Document document, IInvocation invocation, Boolean generateNamedParameters, SemanticModel semanticModel)at MappingGenerator.Features.Suggestions.MethodParametersSuggestionProvider.SuggestMethodParameters(CompletionContext context, IInvocation invocation, SemanticModel semanticModel)at MappingGenerator.Features.Suggestions.MethodParametersSuggestionProvider.d 3.MoveNext() --- 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 Microsoft.CodeAnalysis.Completion.CompletionServiceWithProviders.d35.MoveNext() --- 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 Microsoft.CodeAnalysis.Completion.CompletionServiceWithProviders. d 29.MoveNext() --- 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.ValidateEnd(Task task)at Microsoft.CodeAnalysis.Completion.CompletionServiceWithProviders.d26.MoveNext() --- 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.ValidateEnd(Task task)at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion.CompletionSource. d 25.MoveNext() --- 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 Microsoft.VisualStudio.Text.Utilities.GuardedOperations.d__36`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
What do you mean by " as soon as StartsWith() is entered"? Looking good on VS 16.5.4, I'm trying to update my VS to the newest version.
UPDATE: I'm not able to reproduce it with VS 16.7.2. Can you attach a sample solution where this problem is reproducible?
Here's a video. Notice the yellow exception notification pop up right when the method parentheses are typed:
It looks like the MethodParametersSuggestionProvider
is broken or there is an issue with the part of VS responsible for loading suggestion providers. I need to debug it. I will let you know when I find something.
I not able to reproduce this issue but I suspect it's caused by the local symbols from outside the codebase. Here's a pre-release version with an attempt to fix that issue. Can you install it and check if this works correctly? https://ci.appveyor.com/api/buildjobs/ht21ewfbkabqddcl/artifacts/MappingGenerator%2FMappingGenerator%2FMappingGenerator.Vsix%2Fbin%2FRelease%2FMappingGenerator.vsix
I was able to narrow the issue down to files that have a using static
statement. Here's a simple repro solution with a single static class referenced from vanilla Program.cs:
https://github.com/NoahStahl/MappingGeneratorRepro1
(I'd prefer not to install pre-release direct download versions if possible). Hope this helps to narrow it down.
Thanks for the repro-solution. I will check it today later.
@NoahStahl I wasn't able to reproduce this issue in a deterministic way but I removed a suspicious code that might cause the problem. An officially release version 1.17.442 should contain a fix
I can confirm no longer occurs in either my project or the repro solution. Nice work!
Thanks for this fantastic tool. It's been working well, but I've noticed this issue where Visual Studio periodically encounters an error, which upon inspecting ActivityLog.xml, shows among a few other error lines:
Is there something I can do to resolve this, or provide more info? I'm running VS 2019 Community 16.7.2 with MappingGenerator 1.17.435.