StefanMaron / BusinessCentral.LinterCop

Community driven code linter for AL (MS Dynamics 365 Business Central)
https://stefanmaron.com
MIT License
76 stars 31 forks source link

LC0068 Rule0068CheckObjectPermission - InvalidCastException [AL preview - v14.0.1070882] #724

Open pri-kise opened 2 months ago

pri-kise commented 2 months ago

Since today I receive the following warning:

Analyzer 'BusinessCentral.LinterCop.Design.Rule0068CheckObjectPermission' threw an exception of type 'System.InvalidCastException' with message 'System.InvalidCastException: Unable to cast object of type 'Microsoft.Dynamics.Nav.CodeAnalysis.Symbols.SourceReportColumnSymbol' to type 'Microsoft.Dynamics.Nav.CodeAnalysis.IMethodSymbol'.
   at BusinessCentral.LinterCop.Design.Rule0068CheckObjectPermission.CheckObjectPermission(OperationAnalysisContext ctx)
   at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass54_1.<ExecuteOperationAction>b__1() in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 773
   at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze, Nullable`1 info) in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 1088'

AL Language: v14.0.1070882 (pre-release)

StefanMaron commented 2 months ago

I dont know what code can cause this, but I have added a type check to prevent that error from happening. Let me know if this error still occurs on the latest version