Avoid and fix unexpected memory issues in .NET applications