-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update "dotnet build" CLI command to treat warning as error #1767
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -120,9 +125,9 @@ Function BuildProject($path, $message) | |||
} | |||
} | |||
|
|||
& dotnet build $projectPath --verbosity $verbosity --configuration $configuration | |||
& dotnet build $projectPath --verbosity $verbosity --configuration $configuration -warnAsError | Tee-Object ./buildlog.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what we are doing here is routing the command output to a file and searching the text for the string "Build FAILED".
This is required because:
- dotnet build correctly marks the build as failed (on passing the flag -warnAsError)
- powershell does not report the LASTEXITCODE as not 0 (this behavior is not deterministic, it works sometimes, doesn't at other times)
Linked github discussions see this as an issue in the .NET sdk: https://github.com/dotnet/installer/issues/1708
See two consecutive runs returning different results:
PS S:\csharp\azure> . 's:\csharp\azure\build.ps1' -clean -build -configuration DEBUG
Local packages being used for testing: False
BUILD: --- Azure IoT C# SDK Solution DEBUG ---
cleaning
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
Build FAILED.
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
0 Warning(s)
4 Error(s)
Time Elapsed 00:00:20.48
LASTEXITCODE: 1
Time Elapsed 00:00:23.7478540
Build failed (Build failed: BUILD: --- Azure IoT C# SDK Solution DEBUG ---)
PS S:\csharp\azure> . 's:\csharp\azure\build.ps1' -clean -build -configuration DEBUG
Local packages being used for testing: False
BUILD: --- Azure IoT C# SDK Solution DEBUG ---
cleaning
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
Build FAILED.
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
S:\csharp\azure\iothub\device\src\Edge\EdgeModuleClientFactory.cs(96,34): error CA2000: Call System.IDisposable.Dispose on object created by 'new ModuleAuthenticationWithHsm(signatureProvider, deviceId, moduleId, generationId)' before all references to it are out of scope [S:\csharp\azure\iothub\device\src\Microsoft.Azure.Devices.Client.csproj]
0 Warning(s)
4 Error(s)
Time Elapsed 00:00:22.52
LASTEXITCODE: 0
Time Elapsed 00:00:25.4949819
Build succeeded.
ac4a51a
to
eafac91
Compare
eafac91
to
e61ac55
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
The pipeline is expected to fail, since we have a warning pending: #1768 |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
No description provided.