I'm updating an old VB.Net Aspnet MVC (razor pages) web site. Updating .NET Framework version, Entity Framework, MVC.
It works pretty well, so far, except for a couple of pages that use a @@ operator. I seen that before, to escape Razor's @, in C#.
But in this case, in VB.NET, it returns an Anonymous method that takes an object and returns a System.Web.WebPages.HelperResult.
The following code :
@Code
Dim myString As String
myString = "mystring"
End Code
Double-At : @String.Format("{0}", @@<text>@myString</text>)
<br />
Double-At execution : @String.Format("{0}", (@@<text>Some @myString and then some</text>)(Nothing))
<br />
Outputs :
Double-At : VB$AnonymousDelegate_0`2[System.Object,System.Web.WebPages.HelperResult]
Double-At execution : Somesome mystring and then some
Since I'm not too used to VB.Net, I tried to find the equivalent in C# so that i can play around with it and understand it better but wasn't able to find anything similar.
Googling for VB.Net Razor Double at signs hasn't yield any meaningful answers and i still don't know what that thing is.
Right now, the website I am updating fails with generated code that doesn't compile and that generated code comes from those Double At-Signs fonctions.
And for reference, in case someone has an idea, the generated code that fails to compile, it fails because the @ I'm using inside the @@ get split up on multiple line, even tho they are a single instruction.
For example :
@(Html.Kendo().Window() _
.Name("SomeWindow") _
.Draggable() _
.Modal(True) _
.Title("") _
.Width(300) _
.Content(@@<text>
SomeValue : @LocalizedResources.SomeValue
</text>))
Crashes at runtime compilation (when hitting the page) with the following code:
WriteTo(__razor_template_writer,
#ExternalSource("C:\TestProject\TestPage.vbhtml",141)
#End ExternalSource
##ExternalSource("C:\TestProject\TestPage.vbhtml",141)
LocalizedResources.SomeValue)
#End ExternalSource
The fact that the WriteTo function's second parameter comes on another line makes the compiler spit out an error, BC30205 : End of statement expected.
Any idea what that @@ is? Any idea what it's C# equivalent would be ? Or even suggestions to get my Razor pages to generate code that actually compiles ?