0

I do from template C# console application in Visual Studio 2012. After running an application,it crashes("Attempted to read or write protected memory. This is often an indication that other memory is corrupt" exeption ). This example of code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadKey();
        }
    }
}

But if I try it without "string[] args" everything ok. What wrong?

Jaimesh
  • 841
  • 4
  • 25
  • 41
  • 1
    Code is pretty valid and shouldn't cause crash. Probably it is something wrong with your computer or .NET environment. – Andrey Korneyev May 26 '16 at 12:48
  • Nothing to do with your code. The fact that removing `string[] args` 'fixed' the issue is a red herring. Take a look here: http://stackoverflow.com/questions/4074585/attempted-to-read-or-write-protected-memory-this-is-often-an-indication-that-ot and https://social.msdn.microsoft.com/Forums/vstudio/en-US/4f48c152-68cd-45ec-a11e-baa7de7f79c3/attempted-to-read-or-write-protected-memory?forum=csharpgeneral – Rob May 26 '16 at 12:50
  • You've got some kind of shovelware installed on your machine that is causing the problem. A rogue driver, a badly-written piece of anti-malware software, or whatever. Clean up your machine. This is not a .NET problem. – Cody Gray - on strike May 26 '16 at 13:56

0 Answers0