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

CodeCop bug System.InvalidCastException #5821

Closed kasperdj closed 4 years ago

kasperdj commented 4 years ago

Describe the bug We keep getting the following 2 exception errors in our app.json

Analyzer 'Microsoft.Dynamics.Nav.CodeCop.Design.Rule214BlindWriteLocalRecord' threw an exception of type 'System.InvalidCastException' with message 'System.InvalidCastException: Unable to cast object of type 'Microsoft.Dynamics.Nav.CodeAnalysis.BoundFieldAccess' to type 'Microsoft.Dynamics.Nav.CodeAnalysis.IInvocationExpression'.
   at Microsoft.Dynamics.Nav.CodeCop.Design.Rule214BlindWriteLocalRecord.ProcessingInvocation(SyntaxNode syntaxNode, PooledDictionary`2 processInvocations, SyntaxNodeAnalysisContext syntaxNodeAnalysisContext)
   at Microsoft.Dynamics.Nav.CodeCop.Design.Rule214BlindWriteLocalRecord.<>c.<Analyze>b__5_0(SyntaxNodeAnalysisContext syntaxNodeAnalysisContext) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeCop\Design\Rule214BlindWriteLocalRecord.cs:line 46
   at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass52_1.<ExecuteSyntaxNodeAction>b__1() in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 742
   at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze, Nullable`1 info) in D:\a\1\s\source\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 1079'

To Reproduce Steps and to reproduce the behavior:

  1. Create a new Project for BC15.
  2. Use the attached screenshots for app.json and settings.json to provoke the error.

AL Code to reproduce the issue

Expected behavior No bugs reported by the CodeCop.

Screenshots image image image

5. Versions:

MarcHansenMicrosoft commented 4 years ago

Known issue. see dup: https://github.com/microsoft/AL/issues/5694