dotnet / dotnet/dotnet-api-docs

Always call Unlock

Open
#971 0 comments 0 reactions 0 assignees View on GitHub
area-WPF dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Please note that you always have to call Unlock, even when TryLock fails, as can be seen from the reference source implementation https://referencesource.microsoft.com/#PresentationCore/Core/CSharp/System/Windows/Interop/D3DImage.cs

The internal reference count is incremented, even when TryLock fails. This is rather counter-intuitive IMHO.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: fed3b5af-09ad-a98f-07a8-cc439a1f8c3c
* Version Independent ID: 919f14d0-40ee-ef18-44f8-fe138852cb5d
* Content: [D3DImage.TryLock(Duration) Method (System.Windows.Interop)](https://docs.microsoft.com/en-us/dotnet/api/system.windows.interop.d3dimage.trylock?view=netframework-4.7.2)
* Content Source: [xml/System.Windows.Interop/D3DImage.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Windows.Interop/D3DImage.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.