Posts

Showing posts with the label tips

Avoid Multiple Cache Refreshes: The Double Check Approach

 In previous articles, we've stressed the importance of caching to enhance the performance of our applications. This time, we're discussing a small yet potent tip to further amplify the benefits derived from caching. A standard caching routine often looks like this: This code is 'functional' and can be regarded as the 'default' approach to caching. Here, we're fetching a value from the cache, and if it's missing, we generate it and store it for future requests. However, a problem arises when we deal with a high-traffic application, such as a .NET Core web application or API, which must handle many concurrent requests. Suppose multiple requests reach this code simultaneously, each finding that it needs to generate the value. In such a case, you'll experience "multiple" refreshes of the same value and several calls to SetValue. To prevent this, we can employ a mutual-exclusion (mutex) lock to restrict multiple threads from accessing the sam...

JustMock and "Failed to initialize coreCLR" on RC2

Image
Unable to start the process. Failed to initialize CoreCLR, HRESULT: 0x80131500 I just installed ASP.NET Core RC2 and was able to get it working from the command line, on some new basic tests projects. But when I tried to do it from Visual Studio I got the following error.  If I tried to run "dotnet" in a console opened from Visual Studio, I would get the same error. So the issue was that something was off for the VS configuration/environment.  After verifying that "dotnet" was able to run perfectly everywhere else I took into the task of comparing the environment variables (dichotomically, of course). One particular variable made the difference: "JUSTMOCK_INSTANCE=XXXXX", so that lead me to notice that JustMock was interfering with it somehow.  So, if you use JustMock just turn it off for RC2 projects. (No need to uninstall it, just disable the profiler)

Fixing Visual Studio 2015 Android Designer with Xamarin

Image
While using Visual Studio 2015 to edit and android layout file ( axml ) I got this error:   The installed Android SDK is too old. Version 24.3.4 or newer is required The number version might be different in your case. Here are a few possible causes for the error: 1) You actually need to upgrade your Android SDK. 2) You have the wrong path for the Android SDK installation on Visual Studio. (change it on Tools->Options->Xamarin) 3) Mixed Xamarin extensions (this was my case) After reinstalling the Android SDK and checking the everything was fine on that part I went to check on Visual Studio extensions ( Tools -> Extensions and Updates ). It turns out that  I caused a mix up of versions, since I already had Xamarin and Visual Studio 2013 side by side. and now 2015 had another one, my Visual Studio 2015 ended up with 2 extensions for Xamarin. Disabling one of them solved the problem and the designer was working again. The one that I disabled was titled "...