0

Please someone can tell me about what could possibly be causing this error below :

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.String.wcslen(Char* ptr) at System.String.CtorCharPtr(Char* ptr) at System.Runtime.InteropServices.Marshal.PtrToStringUni(IntPtr ptr) at Microsoft.Win32.SystemEvents.GetUserPreferenceCategory(Int32 msg, IntPtr wParam, IntPtr lParam) at Microsoft.Win32.SystemEvents.OnUserPreferenceChanging(Int32 msg, IntPtr wParam, IntPtr lParam) at Microsoft.Win32.SystemEvents.WindowProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at My.Program.Main(String[] args)

Application: My.exe (C#) Framework Version: v4.0.30319 Installed .Net Framework : 4.5.2

Mi2
  • 9
  • 1
  • 2
  • 2
    Possible duplicate of [Attempted to read or write protected memory. This is often an indication that other memory is corrupt](https://stackoverflow.com/questions/4074585/attempted-to-read-or-write-protected-memory-this-is-often-an-indication-that-ot) – TidyDev Jan 24 '18 at 08:31
  • Try running the application as Administrator. If you are debugging via VS, then run VS as Administrator. – Thomas K Jan 24 '18 at 08:38
  • 1
    What in your code is making the crash? – BugFinder Jan 24 '18 at 08:55
  • It could be that you are passing a string literal (`"Some Text"`) to a function that is expecting a string it can modify. But without your code that's just a shot in the dark, which is coincidentally what .... :) – Code Gorilla Jan 24 '18 at 09:07

0 Answers0