Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 922 Bytes

concurrentqueue_trypeek-can-return-an-erroneous-null-via-its-out-parameter.md

File metadata and controls

35 lines (24 loc) · 922 Bytes

ConcurrentQueue<T>.TryPeek can return an erroneous null via its out parameter

Scope

Major

Version Introduced

4.5

Version Reverted

4.5.1

Source Analyzer Status

Available

Change Description

In some multi-threaded scenarios, xref:System.Collections.Concurrent.ConcurrentQueue`1.TryPeek(`0@)?displayProperty=name can return true, but populate the out parameter with a null value (instead of the correct, peeked value).

  • Quirked
  • Build-time break

Recommended Action

This issue is fixed in the .NET Framework 4.5.1. Upgrading to that Framework will solve the issue.

Affected APIs

  • M:System.Collections.Concurrent.ConcurrentQueue`1.TryPeek(`0@)

Category

Core

More information