Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

dotnet jb inspectcode... runs locally on windows, but fails in bitbucket pipeline linter

Alex Bondarev April 1, 2024

I have 'dotnet jb inspectcode' task in bb pipeline which fails with warnings but without error , same task runs file locally on windows from command line..

all warnings (same warnings locally, but html report was created) are about possible nulls and not signed assembly

Warning: [MsBuild] /opt/atlassian/pipelines/agent/build/BiscomAwsKmsHelper/WinCred/ModelActions.cs (156,16)->(156,16) CS8603: Possible null reference return.
39
Warning: [MsBuild] CSC (0,0)->(0,0) CS8002: Referenced assembly 'Meziantou.Framework.Win32.CredentialManager, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name.
40
41
--------
what could be the problem in bitbucket pipeline?

 

1 answer

1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2024

Hello @Alex Bondarev ,

thank you for reaching out to the Community!

The reason why you are getting a different output when running locally compared with pipelines may be because the environment settingsare different across both of them, such as the dotnet core version, dependencies you have installed, and the operating system.

For us to better understand the issue, I would like to ask you a few questions:

  • Are you running this build in atlassian infrastructure or in a self-hosted runner ? 
  • If it's a self-hosted runner, could you confirm if it's a Linux Docker runner (runs in a docker container) or a Windows runner (runs natively directly in powershell) ? 
  • In order to reproduce the environment as close as the pipelines, could you try to run your build locally following the instructions of Troubleshoot failed Bitbucket Pipelines locally with Docker  and check if the same error occurs ? This can help to identify if the issue is with the image/dependencies you are currently using in pipelines, allowing you to debug the error locally, and once you've got the command working well with the correct combination of images/dependencies you can then update your bitbucket-pipelines.yml to match

Thank you, @Alex Bondarev .

Patrik S

Alex Bondarev April 3, 2024

pipeline runs in bitbucket cloud, build is fine

pipeline yml file starts with - i understand that this is linux image

```

image: mcr.microsoft.com/dotnet/sdk:8.0
```
the failing line is the last in here: 
```
- dotnet new tool-manifest
- dotnet tool install JetBrains.ReSharper.GlobalTools
- dotnet tool restore
- dotnet jb inspectcode ${SOLUTION_NAME}.sln -f=html --include="**/*.cs" -o="${REPORTS_PATH}/jb-${BITBUCKET_BUILD_NUMBER}.html"
```
when i convert this script to bat file to run locally on windows - it runs fine

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events