Is System.WIndows.Application static members thread safe?

Static application elements must be thread safe:

Public static (Shared in Visual Basic) members of this type are threads safely. In addition, FindResource and TryFindResource and Properties and Properties are stream safe. 1

How much can we trust this statement in a multi-threaded environment when invoking static member methods in System.Windows.Application?

Update:
All this in connection with this issue: Threading errors with Application.LoadComponent (key already exists)

I never thought that I would see a real mistake in the library, but it must be a day for me ... this question seems to show a genuine error. This is usually a "user error", but this does not seem to be the case.

+3
source share
2 answers

This is a common template .Net framework and related libraries. Static / General members are considered thread safe unless otherwise specified. If you find an item that is not thread safe and is not marked as such in the documentation, this is a mistake (in the documentation or implementation).

Therefore, I consider it safe to rely on the fact that they are thread safe.

+2
source

In general, you must first trust the documentation, but stop trusting it when something does not work, as advertised.

In this case, the documentation is incorrect due to an error in WPF. See this answer for details of the error.

+1

Source: https://habr.com/ru/post/1737383/


All Articles