System.AccessViolationException: Attempted to read or write protected memory. - C#