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

SA1642SA1643CodeFixProvider fails (and crashes VS) #780

Closed
AArnott opened this issue May 4, 2015 · 5 comments · Fixed by #812
Closed

SA1642SA1643CodeFixProvider fails (and crashes VS) #780

AArnott opened this issue May 4, 2015 · 5 comments · Fixed by #812
Assignees
Milestone

Comments

@AArnott
Copy link
Contributor

AArnott commented May 4, 2015

In a project with StyleCop.Analyzers.1.0.0-alpha005 installed, define this class:

    internal abstract class CustomizableBlockSubscriberBase<TSource, TTarget, TSubscribedElement>
        where TSource : class
        where TTarget : class
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectBuildSnapshotService"/> class.
        /// </summary>
        protected CustomizableBlockSubscriberBase()
        {
        }
    }

Press Ctrl+. on the xml doc comment that gets a diagnostic for having a bad constructor message.

VS crashes, after throwing the exception below. Note that I have filed no less than 3 bugs with VS since we shouldn't be crashing anyway (including dotnet/roslyn#2496 and 2 more internally) but we should of course get StyleCop.Analyzers itself fixed as well.

$exception {"separatorToken"} System.Exception {System.ArgumentException}
Microsoft.CodeAnalysis.dll!Microsoft.CodeAnalysis.SeparatedSyntaxList<Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax>.ReplaceSeparator(Microsoft.CodeAnalysis.SyntaxToken separatorToken, Microsoft.CodeAnalysis.SyntaxToken newSeparator) Line 529 C#
StyleCop.Analyzers!StyleCop.Analyzers.DocumentationRules.SA1642SA1643CodeFixProvider.ParameterToArgumentListSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameters) Unknown
StyleCop.Analyzers!StyleCop.Analyzers.DocumentationRules.SA1642SA1643CodeFixProvider.BuildStandardText(Microsoft.CodeAnalysis.SyntaxToken identifier, Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax typeParameters, string preText, string postText) Unknown
StyleCop.Analyzers!StyleCop.Analyzers.DocumentationRules.SA1642SA1643CodeFixProvider.GetTransformedDocumentAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.CSharp.Syntax.XmlElementSyntax node) Unknown
StyleCop.Analyzers!StyleCop.Analyzers.DocumentationRules.SA1642SA1643CodeFixProvider.RegisterCodeFixesAsync.AnonymousMethod__0(System.Threading.CancellationToken token) Unknown
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.CodeActions.CodeAction.DocumentChangeAction.GetChangedDocumentAsync(System.Threading.CancellationToken cancellationToken) Line 308 C#
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(System.Threading.CancellationToken cancellationToken) Line 111 C#
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(System.Threading.CancellationToken cancellationToken) Line 87 C#
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePreviewOperationsAsync(System.Threading.CancellationToken cancellationToken) Line 102 C#
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(System.Threading.CancellationToken cancellationToken) Line 72 C#
Microsoft.CodeAnalysis.EditorFeatures.dll!Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.GetPreviewOperationsAsync.AnonymousMethod__0() C#
mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.CodeActions.CodeActionOperation>>>.InnerInvoke() Line 680 C#
mscorlib.dll!System.Threading.Tasks.Task.Execute() Line 2498 C#
mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj) Line 2861 C#
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 954 C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 902 C#
mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot) Line 2827 C#
mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Line 2767 C#
mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() Line 2704 C#
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Line 820 C#
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() Line 1161 C#

@sharwell sharwell added the bug label May 4, 2015
@sharwell sharwell added this to the 1.0.0 Alpha 7 milestone May 4, 2015
@sharwell
Copy link
Member

sharwell commented May 4, 2015

There is a very high likelihood that this is fixed by #609.

@sharwell
Copy link
Member

Reported as a Roslyn bug and fixed by both working around the issue and adding a test that will alert us when we upgrade to a version of Roslyn which no longer suffers from the bug.

@AArnott
Copy link
Contributor Author

AArnott commented May 11, 2015

Can you link to the Roslyn bug?

@sharwell
Copy link
Member

I already did above 😉

@AArnott
Copy link
Contributor Author

AArnott commented May 11, 2015

Oh, right. whoops. I thought that was the bug I had filed on another argument validation bug in that same method. But I see you filed this one and it tracks something different.

pdelvo added a commit to pdelvo/StyleCopAnalyzers that referenced this issue Jul 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants