Solving System.OutOfMemoryException and Arithmetic operation resulted in an overflow in Sitecore

Recently I bumped into these 2 .NET errors again after starting a Sitecore site: System.OutOfMemoryException and Arithmetic operation resulted in an overflow. The good news: it’s easy to fix them.

How to fix System.OutOfMemoryException

When you use IIS Express to run your website (using CTRL+F5 in Visual Studio) you might see a yellow page of death saying System.OutOfMemoryException. This could be a 32 / 64 bit conflict, so how can you fix this?
In Visual Studio, go to tools -> Projects and solutions -> Web projects -> check “Use the 64 bit version of IIS Express for web sites and projects”

How to fix Arithmetic operation resulted in an overflow

When I tried running the website again (CTRL+F5) a new error appeared: Arithmetic operation resulted in an overflow. After searching for a bit I bumped into this post on the Sitecore community with the solution

Strangely enough we found a WebCompanion Service Lavasoft that was causing a conflict.

Resolution

1. Open the services window: services.msc.

2. Stop the LavasoftTcpService (from services.msc)

3. Uninstall WebCompanion from Program and Features

4. Rename the two dlls (LavasoftTcpService.dll and LavasoftTcpService64.dll in C:\Windows\System32 and C:\Windows\SysWOW64) if still present

5. Reboot the machine

I hope this saves you some time 🙂