If I create a new MVC project and I put

<div id='@("somedivid")'></div>

in my page it renders as

<div id='somedivid'></div>

However in my converted MVC project if I do the same thing I get a meaningless exception about converting a Tuple to a Position Tagged deep within the MVC Razor RenderView call stack.

Value of type 'Tuple(Of String, Integer)' cannot be converted to 'System.Web.WebPages.Instrumentation.PositionTagged(Of String)'.

This is coming from my compiled view where the code is

WriteAttribute("id", _
    Tuple.Create(" id=""", 277), _
    Tuple.Create("""", 292), _
    Tuple.Create( _
        Tuple.Create("", 282), _
        Tuple.Create(Of System.Object, System.Int32)("somedivid", 282), _
        False _
    ) _
)

I'm thinking that I must have a wrong dll in there and I'm either razor is generating the wrong syntax for WriteAttribute or WriteAttribute has had it's signature changed. Either way I need to update one of them.

I've searched for solutions for this but it all just goes to Microsoft.Owin and my project does not touch that at all.

What dll(s) are the ones that I need to change reference properly?

有帮助吗?

解决方案

I know is almost a year from the question but for someone else that come here (like me today) see this.

I'm using powershell with razor and I found a solution today to a problem like this. I just added at the element tag the @:

You have

<div id="@somedivid"></div>

Try use like this

@:<div id="@somedivid"></div>

This solved my problem using variables inside quotes in IDs and Classes

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top