0

i am making an windows application in c#...

and for that i am using sqlexpress for database and componentfactory's krypton tools for UI components...

i am running this application on x86 plateform...

application works fine..but sometimes when i close the form System.AccessViolationException in System.Windows.Forms.dll comes on dispose...

i added <legacyCorruptedStateExceptionsPolicy enabled="true" /> into app.config under <runtime></runtime>...

i also added [HandleProcessCorruptedStateExceptions] upon main function and dispose...

still this error not solved...

i am attaching an screen shot image..kindly look at image also..
thanks in advance..

enter image description here

1 Answers1

1

Even if you set HandleProcessCorruptedStateExceptions attribute, still you need to wrap your code in try catch

[HandleProcessCorruptedStateExceptions] 
public void TheFunction()
{ 
   try
   {
       // Catch any exceptions in your code
   }
   catch (Exception e) 
   {
        System.Console.WriteLine(e.Message); 
   } 
}
Pavan Chandaka
  • 11,671
  • 5
  • 26
  • 34
  • that works..actually first i added try catch but hadn't put `HandleProcessCorruptedStateExceptions`...with both exceptions handles well.. –  Oct 10 '17 at 06:14