dotnet / dotnet/runtime

[ci-scan] Test failure: System.Net.Security.Tests.SslStreamMutualAuthenticationTest.SslStream_CachedCredentials_IsMutuallyAuthenticatedCorrect

Open
#133,904 1 comment 0 reactions 0 assignees View on GitHub
area-System.Net.Security blocking-clean-ci Known Build Error os-windows untriaged
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

## Build Information
Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1585288
Build error leg or test failing: System.Net.Security.Tests.SslStreamMutualAuthenticationTest.SslStream_CachedCredentials_IsMutuallyAuthenticatedCorrect(protocol: Tls12)
Pull request: https://github.com/dotnet/runtime/pull/133337

## Error Message

```json
{
"ErrorMessage": "Cannot access a disposed object.\r\nObject name: 'System.Net.Security.SafeFreeCredential_SECURITY'.",
"ErrorPattern": "",
"BuildRetry": false,
"ExcludeConsoleLog": false
}
```

### Stack trace

```
System.ObjectDisposedException : Cannot access a disposed object.
Object name: 'System.Net.Security.SafeFreeCredential_SECURITY'.
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
at System.Net.Security.SafeDeleteContext.MustRunInitializeSecurityContext(SafeFreeCredentials& inCredentials, Boolean isContextAbsent, Byte* targetName, ContextFlags inFlags, Endianness endianness, SecBufferDesc* inputBuffer, SafeDeleteContext outContext, SecBufferDesc& outputBuffer, ContextFlags& attributes, SafeFreeContextBuffer handleTemplate)
at System.Net.Security.SafeDeleteContext.InitializeSecurityContext(SafeFreeCredentials& inCredentials, SafeDeleteSslContext& refContext, String targetName, ContextFlags inFlags, Endianness endianness, InputSecurityBuffers& inSecBuffers, ProtocolToken& outToken, ContextFlags& outFlags)
at System.Net.SSPISecureChannelType.InitializeSecurityContext(SafeFreeCredentials& credential, SafeDeleteSslContext& context, String targetName, ContextFlags inFlags, Endianness endianness, InputSecurityBuffers& inputBuffers, ProtocolToken& outToken, ContextFlags& outFlags)
at System.Net.SSPIWrapper.InitializeSecurityContext(ISSPIInterface secModule, SafeFreeCredentials& credential, SafeDeleteSslContext& context, String targetName, ContextFlags inFlags, Endianness datarep, InputSecurityBuffers& inputBuffers, ProtocolToken& outToken, ContextFlags& outFlags)
at System.Net.Security.SslStreamPal.InitializeSecurityContext(SafeFreeCredentials& credentialsHandle, SafeDeleteSslContext& context, String targetName, ReadOnlySpan`1 inputBuffer, Int32& consumed, SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.TlsSession.HandshakeStepForSslStream(ReadOnlySpan`1 input, Int32& bytesConsumed)
at System.Net.Security.SslStream.TryNextMessageViaTlsSession(ReadOnlySpan`1 incomingBuffer, ProtocolToken& token, Int32& consumed)
at System.Net.Security.SslStream.NextMessage(ReadOnlySpan`1 incomingBuffer, Int32& consumed)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Security.Tests.SslStreamMutualAuthenticationTest.SslStream_CachedCredentials_IsMutuallyAuthenticatedCorrect(SslProtocols protocol)
```

### Known issue validation
**Build: :mag_right:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=1585288
**Error message validated:** `[Cannot access a disposed object.
Object name: 'System.Net.Security.SafeFreeCredential_SECURITY'.`]
**Result validation:** :x: Known issue did not match with the provided build.
**Validation performed at:** 9/14/2026 6:48:27 PM UTC

### Report
#### Summary
|24-Hour Hit Count|7-Day Hit Count|1-Month Count|
|---|---|---|
|0|0|0|

Contributor guide

Open the contributing guide

Research direction

Start with the failing System.Net.Security.Tests.SslStreamMutualAuthenticationTest.SslStream_CachedCredentials_IsMutuallyAuthenticatedCorrect test and the linked build log. Trace the SafeFreeCredential_SECURITY disposal reported in the stack trace, and compare the behavior with pull request #133337. Done means the test no longer fails with the disposed-credential exception in the affected build.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
security, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.