You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the example for Strongly typed model usage, I get the following error when I try to complie simple template:
Unable to compile template: (28,69): error CS1031: Type expected
(28,69): error CS1003: Syntax error, ',' expected
(28,70): error CS1003: Syntax error, ',' expected
(28,45): error CS0308: The non-generic type 'RazorEngineTemplateBase' cannot be used with type arguments
(31,67): error CS0115: 'Template.ExecuteAsync()': no suitable method found to override
(33,13): error CS0103: The name 'WriteLiteral' does not exist in the current context
tl1k43uj.51l(5,2): error CS0103: The name 'Write' does not exist in the current context
tl1k43uj.51l(5,8): error CS0103: The name 'Model' does not exist in the current context
After looked on the issue it seems like the problem is related to lack of namespace in my code.
After adding namespace into the code all works as expected.
The problem here is if there is no namespace the result of the following metod RazorEngineCompilationOptionsBuilder.RenderTypeName is ".ModelName".
The inital thought was to add something looks like:
if (string.IsNullOrEmpty(type.Namespace))
{
result = type.Name;
}
At the same time there is one case with the similar result. If the Model is inner class the class name will be incorrect.
I haven't found issues or details about it in documentation.
Could someone please advise are these known issues and is there info about in document?
Just thought that maybe it worth to add if there is no info.
In both cases there is simple workaround.
Just in case the code example can be found here: Exampe
method Example1 for issue with namespace
method Example2 for issue with inner class
The text was updated successfully, but these errors were encountered:
Following the example for Strongly typed model usage, I get the following error when I try to complie simple template:
After looked on the issue it seems like the problem is related to lack of namespace in my code.
After adding namespace into the code all works as expected.
The problem here is if there is no namespace the result of the following metod RazorEngineCompilationOptionsBuilder.RenderTypeName is ".ModelName".
The inital thought was to add something looks like:
At the same time there is one case with the similar result. If the Model is inner class the class name will be incorrect.
I haven't found issues or details about it in documentation.
Could someone please advise are these known issues and is there info about in document?
Just thought that maybe it worth to add if there is no info.
In both cases there is simple workaround.
Just in case the code example can be found here: Exampe
method Example1 for issue with namespace
method Example2 for issue with inner class
The text was updated successfully, but these errors were encountered: