Code Optimization

Interesting things about software development and code optimization

Performance Profiler Could not load type System.Threading.Interlocked

If you run into this issue trying to profiling your code with Visual Studio Performance Profiler and getting this error:

Unhandled exception. System.TypeLoadException: Could not load type System.Threading.Interlocked

This is because of you enabled the checkbox under the CPU Usage > Collect call counts (.Net Only)

Just disable it and it should start working again.


Power of .Net and Windows Update

Hello friends,

Let me first describe all issues I had at once :)

Visual Studio
unknown error  .../Roaming/Microsoft/Visual Studio/ActivityLog.xml
Could not locate appropriate CLR version. Try rebooting, reinstalling.
Failure calling VsHookCLRLoading.

Failed to initialize the Common Language Runtime (CLR) v4.0.30319 with HRESULT 0x80004005. You may fix the problem and try again later.

(unfortunately I didn't capture exact error but Terminal just started and showed error like 0x........)

What was that? In my case it was just windows update installed :)

after some googling I have found solution from microsoft and in my case this one line resolved all issues:

dism /online /enable-feature /featurename:netfx3 /all

if you have WCF then you may need these two as well:

dism /online /enable-feature /featurename:WCF-HTTP-Activation
dism /online /enable-feature /featurename:WCF-NonHTTP-Activation

Thank you and good luck :)