If I have a page with:
@section SomeStuff { This is a section I just addered } >
@section SomeStuff { This is a section I just addered }
I encountered a similar issue when I was trying to dynamically inject code into an inline script, I solved it via:
@if (someCondition) { @Html.Raw(@" Your stuff here "); }