Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to CoCreate Profiler error - but not using a profiler

We're getting a:

.NET Runtime version 2.0.50727.5448 - Failed to CoCreate profiler

message in the Event Viewer on our webserver, along with an accompanying:

.NET Runtime version 4.0.30319.239 - Loading profiler failed during CoCreateInstance. Profiler CLSID: '{d37a1b78-6dc5-46fc-bc31-f7c4d5a11c9c}'. HRESULT: 0x8007007e. Process ID (decimal): 224. Message ID: [0x2504].

The thing is, we're not trying to use a profiler, there are no profiler's running or installed on the server and the code makes no reference to profilers anywhere...

We've tried removing the registry keys that other's have pointed out are related to these messages but to no avail; it would seem that two of our websites/webapps are firing off the error, one using .Net2 and the other using 4, but I'm not sure where to look.

like image 244
Dale Avatar asked Apr 04 '12 14:04

Dale


4 Answers

After much searching I found that someone had previously installed dotTrace, then uninstalled it, however the uninstall wasn't very clean and had left the registry littered with entries, though we'd removed some entries we thought could stop the problem there were more specific to that profiler.

After removing all registry entries related to dottrace and the CSID it presented we no longer have the error appearing in the event viewer.

See this answer for a script to aid in hunting down such entries: https://stackoverflow.com/a/36129656/361842

like image 171
Dale Avatar answered Oct 18 '22 01:10

Dale


Removing Environment variable COR_ENABLE_PROFILING (or set it to 0) from User variables (Control panel > System > Advanced system settings > Environment variables) solved my problem (Could not start MongoVUE)

like image 44
Andreas Avatar answered Oct 18 '22 02:10

Andreas


While removing all the references to the profiler's CLSID in the registry can't be a bad thing, you can also choose to just disable profiling by setting the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\COR_ENABLE_PROFILING to 0

like image 16
Kevin Gosse Avatar answered Oct 18 '22 02:10

Kevin Gosse


To help find where this tool may be used, the below PowerShell code can be used to help detect environment variables and registry entries relating to the profiler:

clear-host
if (-not (get-psdrive HKU)) {
    New-PSDrive HKU Registry HKEY_USERS
    Set-Location HKU:
}
"COR_ENABLE_PROFILING: $env:COR_ENABLE_PROFILING "
"COR_PROFILER: $env:COR_PROFILER"
$GUID = $env:COR_PROFILER
@(
    "HKLM:\Software\Classes\CLSID\$GUID",
    "HKLM:\SOFTWARE\Classes\Wow6432Node\CLSID\$GUID",
    "HKLM:\SOFTWARE\Wow6432Node\Classes\CLSID\$GUID",
    "HKU:\*\Software\Classes\CLSID\$GUID"
) |
    get-item  | 
    %{$p = $_.Name;Get-ItemProperty $_.PSPath ''} | 
    select @{N='Path';E={$p}}, '(default)'

get-itemproperty 'HKLM:\SYSTEM\CurrentControlSet\Services\*\' 'Environment' -ea SilentlyContinue | 
    %{
        $serviceName = $_.PSChildName
        $x = new-object PSObject -Property @{ServiceName=$serviceName}
        $_ | select -expand Environment | 
            %{if($_ -match '^(?<Name>[^=]+)(=)?(?<Value>.*)$'){$x | Add-Member -MemberType NoteProperty -Name $matches['Name'] -Value $matches['Value']}}
        $x
    } |
    ?{$_.COR_ENABLE_PROFILING -eq 1} | 
    ft ServiceName, COR_ENABLE_PROFILING, COR_PROFILER, NEWRELIC_INSTALL_PATH -AutoSize

Hope that helps others in future.

like image 12
JohnLBevan Avatar answered Oct 18 '22 01:10

JohnLBevan