Dec 13, 2012, 4:27 PM
MVC 2.1.1 Resource Manager BuildProxy Error , Attempted to access an element as a type incompatible with the array
Hi .
I tried to create "Empty MVC 4 " Project with Razor Target .net 4.5 , so i want to add Ext.net MVC features By Common Steps :
1- Download Latest Ext.net MVC dll's via This URL and Extracting in a Lib Folder .
2- Adding All Extracted Dll's to My Project References .
3- Some changing in web.config file that placed in root folder of my Project .
5- Some changing RouteConfig.cs file :
9- An exception has occurred in this Line :
10- when i add pdb files to bin this call stack shows the main problem :
There is a Bug .
Regards .
I tried to create "Empty MVC 4 " Project with Razor Target .net 4.5 , so i want to add Ext.net MVC features By Common Steps :
1- Download Latest Ext.net MVC dll's via This URL and Extracting in a Lib Folder .
2- Adding All Extracted Dll's to My Project References .
3- Some changing in web.config file that placed in root folder of my Project .
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false"/>
</configSections>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<extnet scriptMode="Release" theme="Gray"/>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="Ext.Net"/>
<add namespace="Ext.Net.MVC"/>
</namespaces>
<controls>
<add assembly="Ext.Net" namespace="Ext.Net" tagPrefix="ext" />
</controls>
</pages>
<httpHandlers>
<add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
</httpHandlers>
<httpModules>
<add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add
name="DirectRequestModule"
preCondition="managedHandler"
type="Ext.Net.DirectRequestModule, Ext.Net"
/>
</modules>
<handlers>
<add
name="DirectRequestHandler"
verb="*"
path="*/ext.axd"
preCondition="integratedMode"
type="Ext.Net.ResourceHandler"
/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="1.0.0.0-4.5.9" newVersion="4.5.10" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Ext.Net.Utilities" publicKeyToken="2c34ac34702a3c23" />
<bindingRedirect oldVersion="0.0.0.0-2.0.1" newVersion="2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Transformer.NET" publicKeyToken="e274d618e7c603a7" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0" newVersion="2.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
4- Some changing in web.config file that placed in Views folder of my Project .<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="Ext.Net"/>
<add namespace="Ext.Net.MVC"/>
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
<add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false"/>
</httpHandlers>
<httpModules>
<add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net"/>
</httpModules>
<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add
name="DirectRequestModule"
preCondition="managedHandler"
type="Ext.Net.DirectRequestModule, Ext.Net"
/>
</modules>
<handlers>
<add
name="DirectRequestHandler"
verb="*"
path="*/ext.axd"
preCondition="integratedMode"
type="Ext.Net.ResourceHandler"
/>
</handlers>
</system.webServer>
</configuration>
5- Some changing RouteConfig.cs file :
public static void RegisterRoutes(RouteCollection routes)
{
// routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{exclude}/{extnet}/ext.axd");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
6- Create an HomeController : public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
}
7- Create a View For Index :
<!DOCTYPE html>
<html>
<head>
<title>Ext.NET MVC Sample</title>
</head>
<body>
@Html.X().ResourceManager()
<a href="http://www.ext.net/"><img src="http://speed.ext.net/identity/extnet-logo-small.png" alt="" /></a>
@(Html.X().Window()
.Title("A sample Ext.net .net4.5")
.Height(215)
.Width(350)
.DefaultButton("Button1")
.Layout("fit")
.Items(Html.X().FormPanel()
.DefaultAnchor("100%")
.BodyPadding(5)
.Frame(true)
.Items(Html.X().TextArea()
.Name("message")
.EmptyText("Empty Txt")
.FieldLabel("Message")
.Height(85)
)
.Buttons(Html.X().Button()
.ID("Button1")
.Text("Submit")
.Icon(Icon.Accept)
.DirectClickAction("SampleAction")
)
)
)
</body>
</html>
8- Run the Project in Debugging mode 9- An exception has occurred in this Line :
@Html.X().ResourceManager()
: Error executing child request for handler 'Ext.Net.SelfRenderingPage' Attachment 526610- when i add pdb files to bin this call stack shows the main problem :
Attempted to access an element as a type incompatible with the array.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.]
System.Collections.Generic.List`1.set_Item(Int32 index, T value) +24
System.Collections.ObjectModel.Collection`1.SetItem(Int32 index, T item) +55
System.Web.Routing.RouteCollection.SetItem(Int32 index, RouteBase item) +58
System.Collections.ObjectModel.Collection`1.set_Item(Int32 index, T value) +116
System.Web.Mvc.ControllerContext.get_RequestContext() +25
Ext.Net.MVC.MvcDirectMethod.BuildProxy(ViewContext viewContext) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2.1\Ext.Net\MVC\DirectMethods\MvcDirectMethod.cs:207
Ext.Net.ResourceManager.BuildDirectMethodProxies(Boolean dynamicOnly) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2.1\Ext.Net\Core\ResourceManager\ResourceManager.cs:1197
Ext.Net.ResourceManager.BuildDirectMethodProxies() in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2.1\Ext.Net\Core\ResourceManager\ResourceManager.cs:1174
Ext.Net.ResourceManager.BuildScriptBlock(Boolean withFunctionTemplate) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2.1\Ext.Net\Core\ResourceManager\ResourceManager.cs:1509
Ext.Net.ResourceManager.BuildScriptBlock() in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2.1\Ext.Net\Core\ResourceManager\ResourceManager.cs:1479
Ext.Net.ResourceManager.BaseRenderAction() in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2.1\Ext.Net\Core\ResourceManager\ResourceManager.cs:426
Ext.Net.BaseControl.Render(HtmlTextWriter writer) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2.1\Ext.Net\Core\BaseControl\Lifecycle.cs:1012
Ext.Net.ResourceManager.Render(HtmlTextWriter writer) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2.1\Ext.Net\Core\ResourceManager\ResourceManager.cs:225
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +9695462
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +9695462
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386
There is a Bug .
Regards .