Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type can't be null #102

Open
snowchenlei opened this issue Mar 31, 2022 · 3 comments
Open

type can't be null #102

snowchenlei opened this issue Mar 31, 2022 · 3 comments

Comments

@snowchenlei
Copy link

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)
@adoconnection
Copy link
Owner

this is basic example known to be working, there is something on your side.

@snowchenlei
Copy link
Author

snowchenlei commented Apr 4, 2022

please try:

  1. create new VSIX Project use VS
  2. import RazorEngineCore.nuget
  3. add new file ==>Extensibility==>Command
  4. add test code in Execute(object sender, EventArgs e)
  5. run. you will get error.

@adoconnection
Copy link
Owner

Hi @snowchenlei unfortunately I had no time to try VSIX 😅
did you succeeded?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants