none
System.AccessViolationException was unhandled Message RRS feed

  • Question

  • Hi, With Visual studio 2013 pro with update 4 and .net framework 4.5.2 , Windows 7 (64 bits), in a form with a text box multiline in debug, I got the following error when I try to type a text: System.AccessViolationException was unhandled Message: An unhandled exception of type 'System.AccessViolationException' occurred in System.Windows.Forms.dll Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. If I change the Textbox to Multiline = False then I do not have any more the problem… someone can help? Thank you

    I'm adding the stack:

                       

    [Managed to Native Transition]
    System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData) Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context) Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) Unknown
    Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() Unknown
    Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() Unknown
    Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(string[] commandLine) Unknown
    [Native to Managed Transition]
    mscorlib.dll!System.AppDomain.nExecuteAssembly(System.Reflection.RuntimeAssembly assembly, string[] args) Unknown
    mscorlib.dll!System.Runtime.Hosting.ManifestRunner.Run(bool checkAptModel) Unknown
    mscorlib.dll!System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() Unknown
    mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext, string[] activationCustomData) Unknown
    mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext) Unknown
    mscorlib.dll!System.Activator.CreateInstance(System.ActivationContext activationContext) Unknown
    Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() Unknown
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() Unknown

    The issue is happening in 1 computer (development). When I install it to another computer it is working! I use VB.net

    • Moved by Tina-Shi Monday, August 10, 2015 3:14 AM related to the windows form
    • Edited by pcr_pas Wednesday, August 12, 2015 10:09 AM
    Thursday, August 6, 2015 10:47 AM

Answers

  • Hi,

    Since this issue is related to the windows form, so we will move this case to the windows form forum, you will get better support.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by pcr_pas Tuesday, August 25, 2015 10:19 AM
    Monday, August 10, 2015 3:14 AM
  • Hi,

    you could try to remove the Application.EnableVisualStyles() in Program.cs.

    Wednesday, August 12, 2015 6:34 AM
  • In a very simple test program, I commented out Application.EnableVisualStyles(); in program.cs and the error no longer occurs.  If I uncomment the line, the error does occur.  Does this indicate a bug that Microsoft needs to fix?
    • Marked as answer by pcr_pas Tuesday, August 25, 2015 10:19 AM
    Wednesday, August 12, 2015 10:22 PM
  • Since the original poster was using Visual Basic, I tried creating a simple test project using VB.  The error occurred, so I looked around.  In Solution Explorer, I double-clicked My Project and unchecked a box labeled "Enable XP Visual Styles" and the error no longer occurred.  (Hopefully, VS 2013 has the same checkbox.)
    • Proposed as answer by Youjun TangModerator Friday, August 14, 2015 9:23 AM
    • Marked as answer by pcr_pas Friday, August 14, 2015 9:41 AM
    Wednesday, August 12, 2015 10:57 PM

All replies

  • I am encountering the same problem with VS 2012 Professional update 4, .net framework 4.5, Windows 7 (64 bits).  I added a multiline TextBox to a Form, and when I run the program, I cannot type text into the textbox without getting  the Attempted to read or write protected memory error.  If I set Multiline to false, the error does not occur.  I don't believe this error was occurring a few months ago.  (This is a C# program.)
    Sunday, August 9, 2015 7:26 PM
  • Hi,

    Since this issue is related to the windows form, so we will move this case to the windows form forum, you will get better support.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by pcr_pas Tuesday, August 25, 2015 10:19 AM
    Monday, August 10, 2015 3:14 AM
  • Hi,

    you could try to remove the Application.EnableVisualStyles() in Program.cs.

    Wednesday, August 12, 2015 6:34 AM
  • In a very simple test program, I commented out Application.EnableVisualStyles(); in program.cs and the error no longer occurs.  If I uncomment the line, the error does occur.  Does this indicate a bug that Microsoft needs to fix?
    • Marked as answer by pcr_pas Tuesday, August 25, 2015 10:19 AM
    Wednesday, August 12, 2015 10:22 PM
  • Since the original poster was using Visual Basic, I tried creating a simple test project using VB.  The error occurred, so I looked around.  In Solution Explorer, I double-clicked My Project and unchecked a box labeled "Enable XP Visual Styles" and the error no longer occurred.  (Hopefully, VS 2013 has the same checkbox.)
    • Proposed as answer by Youjun TangModerator Friday, August 14, 2015 9:23 AM
    • Marked as answer by pcr_pas Friday, August 14, 2015 9:41 AM
    Wednesday, August 12, 2015 10:57 PM
  • Hi Tang, Your solution worked indeed (double-clicked My Project and unchecked a box labeled "Enable XP Visual Styles")...thank you very much
    Friday, August 14, 2015 9:41 AM