RazorEngineCore
RazorEngineCore copied to clipboard
type can't be null
IRazorEngine razorEngine = new RazorEngine();
IRazorEngineCompiledTemplate template = razorEngine.Compile("Hello @Model.Name");
string result = template.Run(new
{
Name = "Alexander"
});
catch error:type can't be null
in System.Activator.CreateInstance(Type type, Boolean nonPublic)
in System.Activator.CreateInstance(Type type)
in RazorEngineCore.RazorEngineCompiledTemplate`1.<RunAsync>d__12.MoveNext()
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in RazorEngineCore.RazorEngineCompiledTemplate`1.Run(Action`1 initializer)
this is basic example known to be working, there is something on your side.
please try:
- create new VSIX Project use VS
- import RazorEngineCore.nuget
- add new file ==>Extensibility==>Command
- add test code in Execute(object sender, EventArgs e)
- run. you will get error.
Hi @snowchenlei unfortunately I had no time to try VSIX 😅 did you succeeded?