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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtractMethodCodeRefactoringProvider crashes with System.InvalidCastException #50769

Closed
vsfeedback opened this issue Jan 26, 2021 · 6 comments
Closed
Assignees
Labels
Area-Compilers Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Resolution-Not Reproducible The described behavior could not be reproduced by developers
Milestone

Comments

@vsfeedback
Copy link

vsfeedback commented Jan 26, 2021

馃敆 See AB#1269217

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]

While editing code in VS2019:

System.InvalidCastException : Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingAssemblySymbol' to type 'Microsoft.CodeAnalysis.CSharp.Symbols.SourceAssemblySymbol'.
   at Microsoft.CodeAnalysis.CSharp.DefiniteAssignmentPass.. ctor(CSharpCompilation compilation,Symbol member,BoundNode node,EmptyStructTypeCache emptyStructs,Boolean trackUnassignments,HashSet`1 initiallyAssignedVariables)
   at Microsoft.CodeAnalysis.CSharp.UnassignedVariablesWalker.Analyze(CSharpCompilation compilation,Symbol member,BoundNode node,Boolean convertInsufficientExecutionStackExceptionToCancelledByStackGuardException)
   at Microsoft.CodeAnalysis.CSharp.CSharpDataFlowAnalysis.get_UnassignedVariables()
   at Microsoft.CodeAnalysis.CSharp.CSharpDataFlowAnalysis.get_DataFlowsIn()
   at Microsoft.CodeAnalysis.CSharp.CSharpDataFlowAnalysis.get_Succeeded()
   at Microsoft.CodeAnalysis.CSharp.CSharpDataFlowAnalysis.AnalyzeReadWrite()
   at Microsoft.CodeAnalysis.CSharp.CSharpDataFlowAnalysis.get_Captured()
   at Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.Analyzer.GenerateVariableInfoMap(Boolean bestEffort,SemanticModel model,DataFlowAnalysis dataFlowAnalysisData,Dictionary`2 symbolMap,IDictionary`2& variableInfoMap,List`1& failedVariables)
   at async Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.Analyzer.AnalyzeAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.ExtractMethod.MethodExtractor.ExtractMethodAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.ExtractMethod.AbstractExtractMethodService`3.ExtractMethodAsync[TValidator,TExtractor,TResult](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider.ExtractMethodAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider.GetCodeActionsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Original Comments

Feedback Bot on 1/24/2021, 10:07 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 26, 2021
@jinujoseph jinujoseph added Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead and removed untriaged Issues and PRs which have not yet been triaged by a lead Area-IDE labels Jan 26, 2021
@jaredpar jaredpar removed the untriaged Issues and PRs which have not yet been triaged by a lead label Feb 2, 2021
@jaredpar jaredpar added this to the 16.9 milestone Feb 2, 2021
@jaredpar
Copy link
Member

jaredpar commented Feb 2, 2021

@AlekseyTs tentatively put this in 16.9 as it didn't come with a repro and hence unclear how severe this is. Based on how common the repro is we should punt to 16.10.

@daviburg
Copy link

daviburg commented Feb 2, 2021

I attached an issue reproduction recording from the VS feedback tool when reporting this. Does it not show up?

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Feb 2, 2021

I don't think this issue is actionable. There is something special about the scenario, otherwise there would be a lot of complains about Extract Method refactoring not working. In order to figure out the root cause, we would either need a crash dump with heap, or reliable repro steps.

@daviburg
Copy link

daviburg commented Feb 3, 2021

Sorry to hear. How may I generate a crash dump with heap next time this problem surfaces?

@AlekseyTs
Copy link
Contributor

@sharwell Is Watson report sent automatically in cases like this? Is there a way to locate it? Are there other ways to debug the refactoring crash?

@AlekseyTs AlekseyTs added the Resolution-Not Reproducible The described behavior could not be reproduced by developers label Feb 5, 2021
@AlekseyTs
Copy link
Contributor

Closing as "No Repro" for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Resolution-Not Reproducible The described behavior could not be reproduced by developers
Projects
None yet
Development

No branches or pull requests

5 participants