Class BUTRUnsafeAccessorAttribute
- Namespace
- Bannerlord.UIExtenderEx.Attributes
- Assembly
- Bannerlord.UIExtenderEx.dll
Marks a static stub method to provide direct access to private or internal members across assembly boundaries.
When the declaring assembly is registered, UIExtenderEx transpiles the stub's body to emit direct access IL bypassing runtime visibility checks. If the targeted member cannot be resolved, the stub retains its original placeholder body and logs a diagnostic warning.
Stub methods must provide a placeholder body (such as throw new NotImplementedException();) and should be decorated
with [MethodImpl(MethodImplOptions.NoInlining)] to prevent call-site inlining prior to transpilation. Target resolution
matches Name (or the stub method name if omitted), parameter types, and return type.
Modeled after .NET 8's System.Runtime.CompilerServices.UnsafeAccessorAttribute for compatibility with .NET Framework 4.7.2
and .NET 6.0 runtimes.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class BUTRUnsafeAccessorAttribute : Attribute
- Inheritance
-
BUTRUnsafeAccessorAttribute
- Inherited Members
Examples
[BUTRUnsafeAccessor(BUTRAccessorKind.Field, Name = "_categories")]
[MethodImpl(MethodImplOptions.NoInlining)]
private static ref List<ViewModel> Categories(OptionsVM instance) => throw new NotImplementedException();
Constructors
BUTRUnsafeAccessorAttribute(BUTRAccessorKind)
Initializes a new instance of BUTRUnsafeAccessorAttribute for an instance member.
public BUTRUnsafeAccessorAttribute(BUTRAccessorKind kind)
Parameters
kindBUTRAccessorKind
BUTRUnsafeAccessorAttribute(BUTRAccessorKind, Type)
Initializes a new instance of BUTRUnsafeAccessorAttribute for a static member on a specified type.
public BUTRUnsafeAccessorAttribute(BUTRAccessorKind kind, Type type)
Parameters
kindBUTRAccessorKindThe accessor kind (StaticMethod or StaticField).
typeTypeThe type declaring the target static member.
Properties
Kind
Gets the kind of member accessed by this stub.
public BUTRAccessorKind Kind { get; }
Property Value
Name
Gets or sets the target member name. When null, the stub method's own name is used.
public string? Name { get; set; }
Property Value
Type
Gets the target declaring type for static members. For instance members, the declaring type is inferred from the stub's first parameter.
public Type? Type { get; }
Property Value
This page was last modified at 10/05/2026 13:34:58 +03:00 (UTC).
Commit Message
Author: Vitalii Mikhailov
Commit: f3b725a97c3f299c20e56b5f206e27142ec15edd
* Added C# Auto-Generated XML prefab compilation for patched and dynamic movies, matching vanilla UI performance
* Added name-based property binding fallback for ViewModel subtypes not declared on the parent
* Improved unparseable prefab error logging with name and file details
* Fixed game crash with 3-segment attribute paths
* Added Bannerlord.UIExtenderE...