Skip to content

Conversation

@miloush
Copy link
Contributor

@miloush miloush commented Aug 17, 2025

Problem

Sometimes one needs to find out which options a dependency property has, what the coercion or changed methods are, or which types registers it. More often than not, DPs are initialized in a type with static constructor. In such case, the declaring type is not eligible for beforeFieldInit and the decompiler cannot tell whether the static members have been initialized inline or in the constructor. However, It is non-trivial effort to manually find the constructor and the relevant initialization in it.

Solution

This PR adds an option to always move initializers from static constructors to the declaration.

Before

image

After

image

Reference: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/TextBlock.cs

@siegfriedpammer siegfriedpammer merged commit 0c2b001 into icsharpcode:master Aug 17, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants