BadImageFormatException - Reason behind 32-bit and 64-bit conflict not affecting ASP.NET

0

I created two project

  1. ASP.NET Core Web Application | Core 2.2
  2. ASP.NET Web Application (.NET Framework) | .Net 4.6.1

In my test controller, I used an exported function from a 32-bit unmanaged DLL, using [DllImport("Testing.DLL")]

Copy that 32-bit native DLL file in both the project folders Run as “Any CPU” on my Windows 64-bit Windows 10 with IIS Express (F5 in VS2017)

Project created in Core 2.2 crashed with following exception

[
  {
    "errorCode": -1001,
    "errorString": "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)",
    "exception": {
      "ClassName": "System.BadImageFormatException",
      "Message": "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)",
      "Data": null,
      "InnerException": null,
      "HelpURL": null,
      "StackTraceString": "   at WebApplication1.DCCAPI.BUICExit()\r\n   at WebApplication1.Controllers.TS240Controller.BUICInit() in C:\\Users\\Waqar Azeem\\source\\repos\\WebApplication1\\WebApplication1\\Controllers\\TS240Controller.cs:line 71",
      "RemoteStackTraceString": null,
      "RemoteStackIndex": 0,
      "ExceptionMethod": null,
      "HResult": -2147024885,
      "Source": "WebApplication1",
      "WatsonBuckets": null,
      "BadImageFormat_FileName": null,
      "BadImageFormat_FusionLog": null
    }
  }
]

Looking for some reason why it do not crashed in .Net 4.6.1. What should i compare in both the projects to figure it out.

asp.net-mvc
asp.net-core
iis-express
asked on Stack Overflow Feb 12, 2019 by Waqar • edited Feb 13, 2019 by Waqar

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0