DisableEncoding works only for first SerializeObject-call when using same RazorLightEngine #431
Unanswered
ChristophSol
asked this question in
Q&A
Replies: 1 comment
-
|
Using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
i am currently trying to build several strings using RazorLight and a cshtml-file:
engine.CompileRenderAsync("Assets.Embedded.R4200", layoutParameter)
layoutParameters might contain special characters like '<' or 'ö'. Using both "DisableEncoding()" function when building RazorLightEngine via RazorLightEngineBuilder or using "@(new HtmlString(Model.V02))" inside the cshtml-file works for one call only. All subsequent strings contain those special characters in encoded form (e.g. Ü) I am using the same RazorLightEngine for all calls.
My current workaround is to create a new RazorLightEngine for every call. Trying to change this..
I am logging "engine.Options.DisableEncoding" for every call. It is set to true.
Is it my understanding of Razor that is incomplete (this is the first time I am using it)? Is this the expected behaviour?
I do not exactly know which further information might be useful for help. I am using .net-core 3. Autofac-module is used to create a single instance of RazorLightEngine. I use this entry in my csproj-file:
ItemGroup
None Remove="Assets\Embedded*.cshtml"
EmbeddedResource Include="Assets\Embedded*.cshtml"
ItemGroup
Beta Was this translation helpful? Give feedback.
All reactions