Does not run correctly in VB.net

Dec 22, 2010 at 4:40 PM

I get an error in Vb.net with the sample:

 

string template = "Hello @Model.Name! Welcome to Razor!";
  string result = Razor.Parse(template, new { Name = "World" });

Converted to VB.net

  Dim template As String = "Hello @Model.Name! Welcome to Razor!"

  Dim result As String = Razor.Parse(template, New With {.Name = "World"})

 

I get an error, Unable to compile template.

 

 

Coordinator
Dec 22, 2010 at 9:02 PM

Can you try downloading the latest Changeset and build from that?

Coordinator
Dec 25, 2010 at 7:22 AM
Edited Dec 25, 2010 at 7:38 AM

It has to do with the code generation for the template classes is hard coded for c# and doesn't take into account visual basic. If you don't pass in a model or anonymous type it will work fine.

I've published an update that fixes this issue, however, it still does not work with classes that are subclasses

 

 

Public Class SomeClass

Public Class SomeChildClass

End Class

End Class

 

 

SomeClass.SomeChildClass will not work properly - I'm a bit confused as to why but don't do it for now! :)

Dec 25, 2010 at 8:37 PM

Thank you. Merry x mas

On Dec 25, 2010 2:35 AM, "BuildStarted" <notifications@codeplex.com> wrote:

From: BuildStarted

It has to do with the code generation for the template classes is hard coded for c# and doesn't take into account visual basic. If you don't pass in a model or anonymous type it will work fine. I'll see if I can push a change in tonight to fix this.



Read the full discussion online.

To add a post to this discussion, reply to this email (razorengi...