"Bad unmanaged code entry point"

When I try to profile my WCF service host application (this one is a console app) I get this exception:
---
System.Configuration.ConfigurationErrorsException was unhandled
Message="An error occurred creating the configuration section handler for system.serviceModel/behaviors: Bad unmanaged code entry point. (C:\\TecTeacher\\bin\\MediaConsoleHost.exe.Config line 32)"
Source="System.Configuration"
BareMessage="An error occurred creating the configuration section handler for system.serviceModel/behaviors: Bad unmanaged code entry point."
Filename="C:\\TecTeacher\\bin\\MediaConsoleHost.exe.Config"
Line=32
---

Any idea?
And yes: it works when not profiling the app :)

Thanks,
-Christian

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Christian,

    I've seen this before and it looks like an XmlSerializer problem. The config files are deserialized by the .NET Framework, and to do this, it had to create a temporary assembly -- this is what fails sometimes.

    Try granting full access to the system profile's temporary files folder and see if that helps:

    C:\Windows\system32\config\systemprofile\LocalSettings\Temp
  • Do you happen to know where this folder is located for Windows 7 (x64)?
    And what exactly should I grant to who?

    Thanks!
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    I haven't got a Win7 installation handy, but I'd imagine they still abstract the full path using environment variables, eg: %systemroot%\system32\config\systemprofile\localsettings\temp .

    You can try granting "modify" access to SYSTEM (should already have that), your own desktop logon account, and if profiling a service, the service's startup account also.
  • Hi guys!

    I have a similar problem: While profiling WPF application with "line level timing" precision (this is essential), I'm getting the same exception while creating certain controls defined in xaml i.e. Microsoft.Windows.Controls.Calendar. The inner exception says "Bad unmanaged code entry point: <Module>".

    P.S. This only happens in case of "line level timing" precision.
    P.S.S. I tried workaround described here, however (I"m running Vista), couldn't find %systemroot%\system32\config\systemprofile\localsettings\temp folder. I have C:\Windows\system32\config\systemprofile\AppData\Local, which grants full access to System account.
  • In my experience, this almost always means there's a PDB file on the path that the profiler isn't happy with for various reasons (known to occur with Ajax and Unity framework pdb). So eliminate PDBs one by one until you find the culprit(s).
  • Thanks for a swift reply. It indeed was a pdb of a third party library.
  • The problems isn't with the PDB, Unity emits dymanic IL which the profiler has problems with.

    I have compiled the Unity application block from source code so the PDB is accurate and I still get problems.

    Would be nice if Red Gate could finally fix their application... I reported this almost 18 months ago
    http://www.red-gate.com/messageboard/vi ... highlight=
Sign In or Register to comment.