System.BadImageFormatException: Index not found.

7 years ago
Hi,

For a personal project I'm trying nopCommerce. I really love the product, it's feature and architecture. I have tried the installation of nopCommerce from WebMatrix and it works perfectly. However, when I try to start the website using Visual Studio 2012 with IIS Express I run into problems when I go to the administration area. I get an System.BadImageFormatException and it appears comming from the Telerik components. I have include the exception information below. The stranges thing is that it only happens using Visual Studio. The same solution running from WebMatrix or my local IIS doesn't have any problems.

Does anyone else experiencing problems like this and maybe have a solution?

--------------------------------------------------------------------------------

Server Error in '/' Application.

Index not found. (Exception from HRESULT: 0x80131124)

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.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)

Source Error:


Line 5:      <tr>
Line 6:          <td>
Line 7:              @(Html.Telerik().Grid(Model)
Line 8:                  .Name("average-order-report-grid")
Line 9:                  .Columns(columns =>

Source File: d:\Wheel Seven\MyCommerce\Sources\NopCommerce.Web\Administration\Views\Order\OrderAverageReport.cshtml    Line: 7

Stack Trace:


[BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)]
   Telerik.Web.Mvc.{Dynamic}.StyleSheetRegistrarBuilder..ctor(StyleSheetRegistrar styleSheetRegistrar) +0
   lambda_method(Closure , StyleSheetRegistrar ) +35
   Telerik.Web.Mvc.UI.HtmlHelperExtension.Telerik(HtmlHelper`1 helper) +836
7 years ago
vlesierse wrote:
Hi,

For a personal project I'm trying nopCommerce. I really love the product, it's feature and architecture. I have tried the installation of nopCommerce from WebMatrix and it works perfectly. However, when I try to start the website using Visual Studio 2012 with IIS Express I run into problems when I go to the administration area. I get an System.BadImageFormatException and it appears comming from the Telerik components. I have include the exception information below. The stranges thing is that it only happens using Visual Studio. The same solution running from WebMatrix or my local IIS doesn't have any problems.

Does anyone else experiencing problems like this and maybe have a solution?

--------------------------------------------------------------------------------

Server Error in '/' Application.

Index not found. (Exception from HRESULT: 0x80131124)

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.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)

Source Error:


Line 5:      <tr>
Line 6:          <td>
Line 7:              @(Html.Telerik().Grid(Model)
Line 8:                  .Name("average-order-report-grid")
Line 9:                  .Columns(columns =>

Source File: d:\Wheel Seven\MyCommerce\Sources\NopCommerce.Web\Administration\Views\Order\OrderAverageReport.cshtml    Line: 7

Stack Trace:


[BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)]
   Telerik.Web.Mvc.{Dynamic}.StyleSheetRegistrarBuilder..ctor(StyleSheetRegistrar styleSheetRegistrar) +0
   lambda_method(Closure , StyleSheetRegistrar ) +35
   Telerik.Web.Mvc.UI.HtmlHelperExtension.Telerik(HtmlHelper`1 helper) +836


Have you tried a "Rebuild" of the whole solution in Visual Studio before running? :)
7 years ago
Thank you for the response. I have tried without any succes.
7 years ago
I also went through a standard Telerik upgrade (we have full offering) and now I'm unable to access admin site for the same reasons as above.

Index not found. (Exception from HRESULT: 0x80131124)  BadImageFormatException  

=====

[BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)]
   Telerik.Web.Mvc.{Dynamic}.StyleSheetRegistrarBuilder..ctor(StyleSheetRegistrar styleSheetRegistrar) +0
   lambda_method(Closure , StyleSheetRegistrar ) +55
   Telerik.Web.Mvc.UI.ComponentBuilderBase`2.Create(TComponent component) +333
   Telerik.Web.Mvc.UI.HtmlHelperExtension.Telerik(HtmlHelper`1 helper) +1173
   ASP._Page_Administration_Views_Order_OrderAverageReport_cshtml.Execute() in d:\_PGRWS_nopCommerce_3.00_DEVELOPMENT\VisualStudioFiles\Presentation\Nop.Web\Administration\Views\Order\OrderAverageReport.cshtml:7
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +499
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +319
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +486
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +1033
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +620
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +684
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +295
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +341
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +709
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +342
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +709
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +342
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +709
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +342
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +709
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +342
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +616
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +355
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +454
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +401
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +342
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +328
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +278
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +337
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +418
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +352
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +281
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +277
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +337
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +418
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +352
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +281
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +277
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +277
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +278
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +337
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +418
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +352
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +281
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +278
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +276
   System.Web.Mvc.<>c__DisplayClassa.<EndProcessRequest>b__9() +264
   System.Web.Mvc.<>c__DisplayClass4.<Wrap>b__3() +317
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +329
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Action action) +333
   System.Web.Mvc.ServerExecuteHttpHandlerAsyncWrapper.EndProcessRequest(IAsyncResult result) +363
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2844

[HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +4057
   System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +502
   System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +437
   System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +379
   System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +1294
   System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +428
   System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName) +359
   ASP._Page_Administration_Views_Home_Index_cshtml.Execute() in d:\_PGRWS_nopCommerce_3.00_DEVELOPMENT\VisualStudioFiles\Presentation\Nop.Web\Administration\Views\Home\Index.cshtml:29
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +499
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +319
   System.Web.WebPages.StartPage.RunPage() +304
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +332
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +472
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +1033
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +620
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +684
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +295
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +341
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +709
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +342
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +709
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +342
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +709
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +342
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +709
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +342
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +616
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +355
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +454
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +401
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +342
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +328
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +278
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +337
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +418
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +352
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +281
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +277
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +337
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +418
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +352
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +281
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +277
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +277
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +278
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +337
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +418
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +352
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +281
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +278
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +276
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1176
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +656
7 years ago
It looks like it has something to do with an installed component on my computer. I have another laptop where I don't have problems with debugging and running nopCommerce. I try to isolate what component is responsible for this behaviour. My first guess would be another Telerik product (JustMock). Although this should not have any relationship with web components.
7 years ago
I had this issue in a way previously... specifically when I allowed the Telerik Control Panel to update internal builds.   I'm trying an uninstall and re-install of build components from Telerik.  I've seen similar issues with Telerik when you  had to clean out the Microsoft.NET Temporary folders.
7 years ago
All said and done... I pulled out (uninstalled) the entire Telerik last update- re-installed Telerik and rebuilt the project and the error is gone.
7 years ago
Greate! Maybe we can isolate this in a separate empty project and create a bug report.
7 years ago
I also got this error after updating my local install of Telerik components.  I uninstalled and reinstalled parts of the Telerik suite and narrowed the problem down to JustMock, just like vlesierse thought.

Uninstalling JustMock should do the trick.