microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
744 stars 245 forks source link

Rule137DoNotDeclareVariablesThatAreUnused throws an exception casting IdentifierNameOrEmptySyntax to IdentifierNameSyntax #4588

Closed JuricaB closed 5 years ago

JuricaB commented 5 years ago

Describe the bug AL extension for VS Code reports multiple errors in app.json, all with same text : Analyzer 'Microsoft.Dynamics.Nav.CodeCop.Design.Rule137DoNotDeclareVariablesThatAreUnused' threw an exception of type 'System.InvalidCastException' with message 'System.InvalidCastException: Unable to cast object of type 'Microsoft.Dynamics.Nav.CodeAnalysis.Syntax.IdentifierNameOrEmptySyntax' to type 'Microsoft.Dynamics.Nav.CodeAnalysis.Syntax.IdentifierNameSyntax'. at Microsoft.Dynamics.Nav.CodeCop.Design.Rule137DoNotDeclareVariablesThatAreUnused.UnusedVariableAnalyzer.AnalyzeSyntaxNode(SyntaxNodeAnalysisContext context) in C:\a\810\s\source\Prod\Microsoft.Dynamics.Nav.CodeCop\Design\Rule137DoNotDeclareVariablesThatAreUnused.cs:line 171 at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass52_1.b__1() in C:\a\810\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 745 at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze, Nullable`1 info) in C:\a\810\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 1082'

To Reproduce Steps and/or AL code to reproduce the behavior: This appears to happen if there are any warnings on compilation, but persists even if those warnings are resolved.

Expected behavior Would expect not to get this error.

Screenshots If applicable, add screenshots to help explain your problem.

Versions:

ALGitHubBot commented 5 years ago

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 28234 and VS Code Extension Version 2.1.95346.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://blogs.msdn.microsoft.com/freddyk/2018/04/16/which-docker-image-is-the-right-for-you/