2
Vote

Attempted to access an element as a type incompatible with the array

description

Hi,

I' m passing an IQuerable to a view with gridmvc using simplest possible code:
   @Html.Grid(Model).Columns(columns =>
                { columns.Add(c => c.DocumentID); })
When I visit the page I get the error message:
   "Attempted to access an element as a type incompatible with the array"
If I revisit page I get this one:

The runtime has encountered a fatal error. The address of the error was at 0x69af3568, on thread 0x1bc8. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Using VS2012 and MVC 4 with Razor. Started from Empty project.

Thanks

comments

Bukharin wrote Oct 7, 2013 at 6:17 PM

Hi,

Any call stack was provided?

khartman1 wrote Oct 10, 2013 at 5:17 AM

Experienced same issue, .net 4.5 vs2012, mvc4 latest bootstrap 3.0.

dineshrathod wrote Mar 1 at 6:32 AM

dineshrathod wrote Mar 1 at 6:51 AM

Hello Friends,

to resolve this error add following code to your web.config file.

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
</assemblyBinding>
</runtime>

Please Test it and give your Reply..
~Dinesh Rathod

mosta wrote Mar 29 at 11:10 AM

@Dinesh
The web.config fixed it for me thanks, and I use VB.NET