"Bad unmanaged code entry point"

Code profiling for .NET Developers

Moderators: StephenC, Alex.Davies, AndrewH

"Bad unmanaged code entry point"

Postby ChristianWeyer » Thu Oct 08, 2009 12:08 pm

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
ChristianWeyer
 
Posts: 4
Joined: Thu Oct 08, 2009 12:04 pm

Postby Brian Donahue » Thu Oct 08, 2009 2:05 pm

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
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby ChristianWeyer » Thu Oct 08, 2009 2:18 pm

Do you happen to know where this folder is located for Windows 7 (x64)?
And what exactly should I grant to who?

Thanks!
ChristianWeyer
 
Posts: 4
Joined: Thu Oct 08, 2009 12:04 pm

Postby Brian Donahue » Thu Oct 08, 2009 3:24 pm

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.
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

similar issue

Postby danielf » Tue May 04, 2010 4:14 pm

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.
danielf
 
Posts: 2
Joined: Tue May 04, 2010 3:52 pm

Postby slaphead99 » Wed May 05, 2010 2:46 pm

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).
slaphead99
 
Posts: 92
Joined: Wed Mar 10, 2010 2:27 pm

Postby danielf » Wed May 05, 2010 6:00 pm

Thanks for a swift reply. It indeed was a pdb of a third party library.
danielf
 
Posts: 2
Joined: Tue May 04, 2010 3:52 pm

Postby slaneyrw » Mon May 10, 2010 3:30 am

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=
slaneyrw
 
Posts: 28
Joined: Tue Feb 08, 2005 10:01 pm


Return to ANTS Performance Profiler 5

Who is online

Users browsing this forum: No registered users and 0 guests