StefanMaron / BusinessCentral.LinterCop

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

Rule0052InternalProceduresNotReferencedAnalyzer System.MissingMethodException: Method not found #588

Closed pri-kise closed 5 months ago

pri-kise commented 5 months ago

We receive the following warning in our azure devops pipeline:

##[warning]warning AD0001: 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.ManifestHelper.GetManifest(Microsoft.Dynamics.Nav.CodeAnalysis.Compilation)'.
##[warning]at BusinessCentral.LinterCop.Design.Rule0052InternalProceduresNotReferencedAnalyzer.MethodSymbolAnalyzer..ctor(CompilationAnalysisContext compilationAnalysisContext)
##[warning]at BusinessCentral.LinterCop.Design.Rule0052InternalProceduresNotReferencedAnalyzer.CheckApplicationObjects(CompilationAnalysisContext compilationAnalysisContext)
##[warning]at Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass48_1.<ExecuteCompilationActionsCore>b__0() in X:\Prod\Microsoft.Dynamics.Nav.CodeAnalysis\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 618
##[warning]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 1086'

We use the following template to Download the LinterCop

parameters:
  prerelease: 'false'
  alcodeanalyzer: ''

steps:
- task: PowerShell@2
  displayName: 'Download BusinessCentral.LinterCop.dll'
  condition: contains('${{parameters.alcodeanalyzer}}', 'BusinessCentral.LinterCop.dll')
  inputs:
    targetType: 'inline'
    script: |
      $FileName = "DownloadFile.ps1"
      $GitHubUri = "https://raw.githubusercontent.com/StefanMaron/vsc-lintercop/master/$FileName"

      try
      {
          Write-Host "Downloading PowerShell script $GitHubFileName from $GitHubUri..." -ForegroundColor Yellow
          Invoke-WebRequest -Uri $GitHubUri -OutFile $env:AGENT_BUILDDIRECTORY\$FileName
      } 
      catch [System.Net.WebException] 
      {
          Write-Host "Error connecting to $GitHubUri. Please check your file name or repo name and try again." -ForegroundColor Red
      }

      Write-Host "Success. Now executing $FileName" -ForegroundColor Green

      & $env:AGENT_BUILDDIRECTORY\$FileName $env:BUILD_SOURCESDIRECTORY ${{parameters.prerelease}}

Versions:

Maybe this is related to #517

Related PR for LinterCop Download: https://github.com/StefanMaron/vsc-lintercop/pull/14

Arthurvdv commented 5 months ago

Probably releated to https://github.com/StefanMaron/BusinessCentral.LinterCop/issues/590

pri-kise commented 5 months ago

I've tested it with the Latest AL Language version. Now it's working fine. I will have to update our pipelines now, but at least it's working now.