A Blazor Server app has nothing on the client worth protecting — the assembly runs on your server and the browser only sees HTML. A Blazor Hybrid app is the opposite. When you host a BlazorWebView inside a .NET MAUI, WPF or WinForms shell, your Razor components compile into an ordinary managed assembly that ships to the user's machine, where a decompiler reads it like any other desktop binary. That is a good reason to obfuscate it. It is also where people get surprised, because a Blazor component does not pass its parameters the way a method passes arguments. It passes them by name, through a render tree, and the names are strings.
The real question
Rename an assembly and the honest question is always the same: which names does the runtime resolve by their string, and which did the compiler already wire as a direct token reference? For most C# the answer is "tokens" — a method call is a MethodDef reference, a field access is a FieldDef, and renaming rewrites both the definition and every reference together. Component parameters are the exception. The Razor compiler lowers <Counter IncrementBy="@step" /> into code that names the parameter with a string literal, and the renderer matches that string against the child's properties by reflection. Get that distinction right and a Blazor Hybrid app obfuscates as hard as anything else; get it wrong and the app throws on first render.
What the Razor compiler emits
Take a trivial component and the parent that uses it.
@* Counter.razor *@ <p>Count: @Current</p> @code { [Parameter] public int IncrementBy { get; set; } = 1; [Parameter] public EventCallback<int> OnChanged { get; set; } private int Current; } @* Parent.razor *@ <Counter IncrementBy="5" /> @code { private void Handle(int v) { /* ... */ } } The Razor compiler turns each .razor file into a C# class with a BuildRenderTree method. The parent's, trimmed to the part that matters, is this:
protected override void BuildRenderTree(RenderTreeBuilder __builder) { __builder.OpenComponent<MyApp.Components.Counter>(0); __builder.AddComponentParameter(1, "IncrementBy", 5); __builder.AddComponentParameter(2, "OnChanged", EventCallback.Factory.Create<int>(this, Handle)); __builder.CloseComponent(); } (On .NET 7 and earlier this was AddAttribute rather than AddComponentParameter; the string argument is identical.) Two kinds of name now live in this IL, and renaming treats them oppositely.
Strings versus tokens
OpenComponent<MyApp.Components.Counter>(0) carries the Counter type as a generic type argument — a metadata token, emitted by ldtoken/typeof plumbing the JIT resolves to the TypeDef. Rename Counter to a and Nebula rewrites the row and this reference together; the component still opens. The component type name is free.
The parameter names are not. "IncrementBy" and "OnChanged" are user string constants — plain ldstr loads into the #US heap:
IL_0007: ldstr "IncrementBy" IL_000c: ldc.i4.5 IL_000d: box [System.Private.CoreLib]System.Int32 IL_0012: callvirt instance void RenderTreeBuilder::AddComponentParameter(int32, string, object) Nothing in that ldstr tells the obfuscator it names a property. Nebula renames metadata — type, method, field and property names in the tables — and updates the token references to them. It does not rewrite arbitrary string literals to chase a rename, because it cannot know that the text "IncrementBy" is meant to equal a property name rather than, say, a log message. So the string stays "IncrementBy" while the property it was meant to hit becomes a.
What happens next is the whole point. When the renderer instantiates Counter, it hands the component a ParameterView built from those named attributes and calls SetParametersAsync, whose default implementation calls ComponentProperties.SetProperties. That method holds a per-type cache — a Dictionary<string, IPropertySetter> built once by reflecting over the component's properties and keyed on each [Parameter] property's name. After obfuscation that dictionary has a key "a". The incoming attribute is named "IncrementBy". No match, and Blazor does not shrug it off:
System.InvalidOperationException: Object of type 'MyApp.Components.Counter' does not have a property matching the name 'IncrementBy'. Unlike a WPF binding — which logs a path error and leaves the control at its fallback — this throws at the first render of the component. That is a gift: the failure is loud and immediate.
So the keep-list is specific: every [Parameter] and [CascadingParameter] property name, the generated EventCallback parameter names, ChildContent and any other RenderFragment slot, and the Value/ValueChanged pair that @bind-Value expands to. Everything else the component declares — the private @code fields and methods, the component types themselves, an unnamed [CascadingParameter] matched by type — is referenced by token and renames with no effect on rendering.
Scoping Nebula
Blazor's own analyzer requires every [Parameter] property to be public, so the names you must keep are exactly the public surface of your component types. That is a single scoped keep rule. Put a Counter.razor component under a Components namespace and:
{ "schemaVersion": 1, "inputs": ["bin/Release/net8.0/MyApp.dll"], "outputDirectory": "protected", "encryptStrings": true, "controlFlowObfuscation": true, "renaming": { "rules": [ { "pattern": "MyApp.Components.*", "action": "keep", "members": "public" }, { "pattern": "MyApp.*", "action": "rename" } ] } } The first rule keeps the public parameter names on every component while members: "public" lets the private Current field, the Handle method and the component's own type name rename. The second renames everything else — your services, your domain logic, your licensing checks. The keep is name-only: the kept components still get control-flow obfuscation on their method bodies and their string literals encrypted. You surrender renaming on a handful of parameter names, not protection on the code behind them.
If you would rather pin the names in source so they travel with a refactor, Nebula 2.2.0's annotations package does it per member — [Keep] on a parameter property keeps just that name and leaves the rest of the component to rename, and the attribute is stripped from the protected output so it adds no runtime dependency:
using Nebula.Annotations; [Parameter, Keep] public int IncrementBy { get; set; } = 1; Caveats and when it breaks
The loud failure covers the common case, but three edges are quieter. First, coverage: a component rendered only behind a screen your smoke test never opens will not throw until a user gets there, so the honest acceptance test exercises every component at least once against the protected build, not the debug one. Second, JS interop: a [JSInvokable] method is called from JavaScript by its method name, so that name is a string contract — keep it, and keep the type if JS resolves it by name too. Third, DynamicComponent: <DynamicComponent Type="@t" /> where t was produced from a type-name string resolves by name and the target type must be kept; where t came from typeof(...) it is a token and renames freely.
And the framing underneath all of it: this is about protecting your own application's IP. Keep the names the render tree resolves by string; obfuscate the components and the logic behind them.
Takeaway
A Blazor component passes parameters through a name-keyed render tree, so every [Parameter] name lives in your assembly as a string literal the renderer matches by reflection — and renaming it throws on first render rather than failing quietly. The component types, the private @code members and the unnamed cascading parameters are wired by token and rename for free. A members: "public" keep on your components' namespace draws exactly that line, which is why obfuscating a Blazor Hybrid app is a scoping problem, not a reason to leave the shipped assembly in cleartext. Nebula.NET keeps the parameter contract and obfuscates everything behind it; open the result in Glass.NET to confirm your parameter names survived while the component internals read as a, b, c.

