dotnet / dotnet/sign

0.9.1-beta.26431.1+f59a28db2c6040c4db9332d08edcda467e6fd431 causes System.ObjectDisposedException

Open
#1,068 0 comments 0 reactions 0 assignees View on GitHub
area-vsix needs-more-info Priority:3
Dominant language
C#
Stars
581
Forks
116
Avg merge
1d 2h
Merged PRs (30d)
8

Description

We are using sign in Azure DevOps pipeline to sign a vsix. Sometimes it fails with:

Cannot access a disposed object.
Object name: 'Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle'.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle'.
at System.Runtime.InteropServices.SafeHandle.InternalRelease(Boolean disposeOrFinalizeOperation)
at Microsoft.Win32.SafeHandles.SafeNCryptHandle.ReleaseHandle()
at System.Runtime.InteropServices.SafeHandle.InternalRelease(Boolean disposeOrFinalizeOperation)
at System.Runtime.InteropServices.SafeHandle.Dispose()
at System.Security.Cryptography.RSACng.Dispose(Boolean disposing)
at System.Security.Cryptography.AsymmetricAlgorithm.Dispose()
at Sign.Core.AzureSignToolSigner.SignAsync(IEnumerable`1 files, SignOptions options) in /_/src/Sign.Core/DataFormatSigners/AzureSignToolSigner.cs:line 165
at Sign.Core.AggregatingSigner.SignAsync(IEnumerable`1 files, SignOptions options) in /_/src/Sign.Core/DataFormatSigners/AggregatingSigner.cs:line 92
at Sign.Core.AggregatingSigner.SignContainerContentsAsync(IEnumerable`1 files, SignOptions options) in /_/src/Sign.Core/DataFormatSigners/AggregatingSigner.cs:line 124
at Sign.Core.AggregatingSigner.SignAsync(IEnumerable`1 files, SignOptions options) in /_/src/Sign.Core/DataFormatSigners/AggregatingSigner.cs:line 67
at Sign.Core.Signer.<>c__DisplayClass3_0.<b__0>d.MoveNext() in /_/src/Sign.Core/Signer.cs:line 157
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__53`1.<b__53_0>d.MoveNext()
--- End of stack trace from previous location ---
at Sign.Core.Signer.SignAsync(IReadOnlyList`1 inputFiles, String outputFile, FileInfo fileList, Boolean recurseContainers, DirectoryInfo baseDirectory, String applicationName, String publisherName, String description, Uri descriptionUrl, Uri timestampUrl, Int32 maxConcurrency, HashAlgorithmName fileHashAlgorithm, HashAlgorithmName timestampHashAlgorithm) in /_/src/Sign.Core/Signer.cs:line 86

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at src/Sign.Core/DataFormatSigners/AzureSignToolSigner.cs line 165, then trace the signing flow through AggregatingSigner and Signer.cs using the supplied stack trace. Reproduce VSIX signing in an Azure DevOps pipeline and investigate the disposed SafeNCryptKeyHandle failure. Done means signing completes without the intermittent System.ObjectDisposedException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.