StefanMaron / BusinessCentral.LinterCop

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

Not compatible with AL 13.0? #568

Closed NKarolak closed 5 months ago

NKarolak commented 5 months ago

I've just updated the AL Langauge to version 13.0, and I've releaded VS code already twice.

Using a workspace In the PROBLEMS tab, the following warnings are shown for the app.json file: 1)

Analyzer 'BusinessCentral.LinterCop.Design.Rule0052InternalProceduresNotReferencedAnalyzer' threw an exception of type 'System.MissingMethodException' with message 'System.MissingMethodException: Method not found: 'Microsoft.Dynamics.Nav.CodeAnalysis.Packaging.NavAppManifest Microsoft.Dynamics.Nav.Analyzers.Common.AppSourceCopConfiguration.AppSourceCopConfigurationProvider.GetManifest(Microsoft.Dynamics.Nav.CodeAnalysis.Compilation)'.
   at BusinessCentral.LinterCop.Design.Rule0052InternalProceduresNotReferencedAnalyzer.MethodSymbolAnalyzer..ctor(CompilationAnalysisContext compilationAnalysisContext)
   at BusinessCentral.LinterCop.Design.Rule0052InternalProceduresNotReferencedAnalyzer.CheckApplicationObjects(CompilationAnalysisContext compilationAnalysisContext)
   at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass49_1.<ExecuteCompilationActionsCore>b__0() in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 625
   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'

2)

Analyzer 'BusinessCentral.LinterCop.Design.Rule0033AppManifestRuntimeBehind' threw an exception of type 'System.MissingMethodException' with message 'System.MissingMethodException: Method not found: 'Microsoft.Dynamics.Nav.CodeAnalysis.Packaging.NavAppManifest Microsoft.Dynamics.Nav.Analyzers.Common.AppSourceCopConfiguration.AppSourceCopConfigurationProvider.GetManifest(Microsoft.Dynamics.Nav.CodeAnalysis.Compilation)'.
   at BusinessCentral.LinterCop.Design.Rule0033AppManifestRuntimeBehind.CheckAppManifestRuntime(CompilationAnalysisContext ctx)
   at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass49_1.<ExecuteCompilationActionsCore>b__0() in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 625
   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

Futhermore, the solution cannot be compiled ("Loading workspace" does not finish):

Unhandled exception. Unhandled exception. System.InvalidCastException: Unable to cast object of type 'Microsoft.Dynamics.Nav.CodeAnalysis.Syntax.VarSectionSyntax' to type 'Microsoft.Dynamics.Nav.CodeAnalysis.Syntax.GlobalVarSectionSyntax'.
   at BusinessCentral.LinterCop.Design.Rule0044AnalyzeTransferFields.FindGlobalVariables(SyntaxNode node)
   at BusinessCentral.LinterCop.Design.Rule0044AnalyzeTransferFields.AnalyzeTransferFields(OperationAnalysisContext ctx)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
System.InvalidCastException: Unable to cast object of type 'Microsoft.Dynamics.Nav.CodeAnalysis.Syntax.VarSectionSyntax' to type 'Microsoft.Dynamics.Nav.CodeAnalysis.Syntax.GlobalVarSectionSyntax'.
   at BusinessCentral.LinterCop.Design.Rule0044AnalyzeTransferFields.FindGlobalVariables(SyntaxNode node)
   at BusinessCentral.LinterCop.Design.Rule0044AnalyzeTransferFields.AnalyzeTransferFields(OperationAnalysisContext ctx)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
[Info  - 8:31:28 AM] Connection to server got closed. Server will restart.
true
[Error - 8:31:28 AM] Server process exited with code 3762504530.

When I disable the LinterCop code analyzer, those issues are gone. However, there is still a

[Error - 8:33:08 AM] Sending notification workspace/didChangeConfiguration failed

But I suppose that's no LinterCop issue, as it exists also if I disable the entire LinterCop extension.

Without a workspace Once LinterCop is enabled in the settings, AL cannot finish "Loading workspace". OUTPUT for AL shows:

Unhandled exception. System.InvalidCastException: Unable to cast object of type 'Microsoft.Dynamics.Nav.CodeAnalysis.Syntax.VarSectionSyntax' to type 'Microsoft.Dynamics.Nav.CodeAnalysis.Syntax.GlobalVarSectionSyntax'.
   at BusinessCentral.LinterCop.Design.Rule0044AnalyzeTransferFields.FindGlobalVariables(SyntaxNode node)
   at BusinessCentral.LinterCop.Design.Rule0044AnalyzeTransferFields.AnalyzeTransferFields(OperationAnalysisContext ctx)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
jwikman commented 5 months ago

The last part of your issue (never ending "Loading Workspace") seems to be the same as #567.

Our pipelines that are using LinterCop started to fail yesterday. And it seems to be caused by a change in the BC23.5 container, where the AL Language Extension now is updated to 13.0.14.47012...

Oh, now I see that v13 is already released on VSCode as well!

@Arthurvdv, would this be resolved if you just run your build pipeline? Or are there code changes that needs to be addressed first?

NKarolak commented 5 months ago

Oh, now I see that v13 is already released on VSCode as well!

That's what I meant with "I've just updated the AL Langauge to version 13.0" ;-) However, check https://github.com/microsoft/AL/issues/7664#issuecomment-2006268582

rvanbekkum commented 5 months ago

It seems like AppSourceCopConfigurationProvider.GetManifest has been moved to ManifestHelper.GetManifest which is the main breaking change for LinterCop.

rvanbekkum commented 5 months ago

It looks like the source code did already account for that upcoming change, but now it is a reality.

Arthurvdv commented 5 months ago

I didn't expect the release of the new v13 version of the AL Language today 😯

There's a breaking change between v12 and v13 in the AL Language, where I already had taken into account in the prerelease and now switched to the release version of the LinterCop.

If you updatye to the latest release version of the LinterCop v0.30.15 those error should be gone.

NKarolak commented 5 months ago

If you updatye to the latest release version of the LinterCop v0.30.15 those error should be gone.

How do I do that? I am just using the BusinessCentral.LinterCop extension, v0.1.6

Arthurvdv commented 5 months ago

image

There's an action for that. Best pratice is to not have an AL project open/active (this will lock the .dll file). Closing all VS Code windows should also work (on opening VS Code it will also automatically update to the latest version of the LinterCop).

NKarolak commented 5 months ago

I didn't expect the release of the new v13 version of the AL Language today 😯

Nobody did - even not Microsoft 😁 https://x.com/SBalslev/status/1770020492910485759?s=20

There's an action for that.

Thank you! Despite a missing notification (hitting the action returned nothing to the UI) it is now working again.