Saturday, June 4, 2016

UnHandled Microsoft .Net Framework Exception occured in visual studio devenv.exe in design mode forces visual studio to close (Microsoft Bug)

In this post we are going to see a error which forces the development environment crashes and  close because of user code and makes the developers to stand in a some crucial situation.



Click Here to see bug info
https://connect.microsoft.com/VisualStudio/feedback/details/2769909/an-unhandled-microsoft-net-framework-exception-occured-in-devenv-exe-in-design-mode-of-winforms-forces-the-visual-studio-to-close














    Normally Development environment DevEnv.exe is used to develop the code which needs to run in windows Machines , ya it is Visual studio exe. The purpose of this Development environment is used to give a users a sophisticated way for development like Giving intellisense, showing performance reports, Exeception handling like capturing the errors , notifying to users in run time as well as in design time. In some cases it is fails Let we see the cases where it is failed


Example Design time errors capture in Component in Visual studio while development









     Developing a component is usually a good idea in a application, because we can add anything to the control what ever we thought, like wise developing we have to check each and every stage of that control by dragging it in to Form and see the appearance and properties.After finishing the development we will run the Form and see the visual appearance of the control in the UI.



     When i am developing a custom control , when i tried to drag and drop and see the UI, it looks good . Then later again i changes something in the  Control. Now i got an error says "Not implemented" in the  control which is placed on the form, Then i implemented that functionality, Then again the control in the UI, shows another error in design time like Null Reference, again i implemented that steps for the Control, Again it works correctly, so whenever we design a control development environment visual studio will capture the design time errors and show it in Control itself in design.








    But in this case Now the Form Freezes and closes after a certain time, again when ever i open the form which have that custom control crashes the DEvEnv.exe. I get wondered how The development can gets crashes for a user code which is in development mode, because devenv.exe will capture the design time errors and show it in UI, because then only developers can develop the thing in that development editor , that is the purpose of that editor.









     When the UI freezes , it launches a pop screen with  a message that An UnHandles Microsoft .Net Framework Exception occured in devenv.exe in design mode of winforms, Ya here i am using the Winforms as platform.







            I raised a issue to microsoft , i know that my code is buggy, because it is still under development, but how editor gets closed for used buggy code in development, if it is runtime it is acceptable because we are running in CLR, but in design editor should handle everything and shows it to users













 


  After raising the issue i got a feed back from microsoft like below, it is ideally should not crash visual studio but happening in this case, they are saying cases for unhandling the exceptions.



Click Here to see bug info
https://connect.microsoft.com/VisualStudio/feedback/details/2769909/an-unhandled-microsoft-net-framework-exception-occured-in-devenv-exe-in-design-mode-of-winforms-forces-the-visual-studio-to-close

















Note : 
We cant rely on users code to be correct while developing or in design mode, because it is under changes, so devenv.exe should capture the errors in design mode and show in control in design mode, if it is runtime or running the app we can say that we are rely on users code to be correct for stack overflow exceptions .... 




From this post you can see a Microsoft Bug which persists in visual studio , which is an unhandled exception