System.ObjectDisposedException
जब बटन शैली WinForms आवेदन में FlatStyle.System
पर सेट हैSystem.ObjectDisposedException जब बटन शैली WinForms आवेदन में FlatStyle.System पर सेट है
मैं एक बच्चे के रूप है जो माता-पिता में एक बटन क्लिक पर दिखाई देता है है । और कोड नीचे की तरह चला जाता है।
Public Class Parent
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub btnOpenChild_Click(sender As Object, e As EventArgs) Handles btnOpenChild.Click
Child.Show()
End Sub
End Class
बच्चे के रूप में एक बटन बदल गया है जो खुद को बंद कर देता है।
Public Class Child
Private Sub btnCloseMe_Click(sender As Object, e As EventArgs) Handles btnCloseMe.Click
Me.Close()
End Sub
End Class
कदम अपवाद प्राप्त करने के लिए:
- डीबग मोड में,
Me.Close()
- पर एक को तोड़ने बिंदु डाल तो फिर बच्चे की बंद करें बटन पर क्लिक करें।
- तोड़ने बिंदु खुला नोटपैड की हिट और
- समाधान के लिए वापसी पर फिर जारी रखने के
अपवाद: बटन शैली FlatStyle.System
करने के लिए सेट जब इस स्पष्ट रूप से आ रहा है
System.ObjectDisposedException was unhandled
HResult=-2146232798
Message=Cannot access a disposed object.
Object name: 'Button'.
Source=System.Windows.Forms
ObjectName=Button
StackTrace:
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.PointToScreen(Point p)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(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 System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication2.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
करता है किसी को भी किसी भी विचार है,
यह आपके आवेदन या में एक समस्या खड़ी कर रहा है केवल जानने की इच्छा? –
मेरे रीयलटाइम एप्लिकेशन में क्लोज़ क्लिक पर एक लंबी चल रही प्रक्रिया है जो कम से कम 10 से 15 सेकंड तक जाती है। इस बीच यदि उपयोगकर्ता नोटपैड या शब्द दस्तावेज़ या क्रोम जैसे किसी अन्य एप्लिकेशन पर क्लिक करता है तो यह त्रुटि पॉप अप हो जाती है। –
डीबगिंग यूआई इस तरह की समस्याओं के कारण एक नाटक है। एक डीबगर ब्रेक में खुद को अलग-अलग आग लगने का तरीका होता है, इससे फोकस करने और घटनाओं को चित्रित करने का कारण बन सकता है। इस मामले में, एक और प्रक्रिया को सक्रिय करना ट्रिगर है। मुझे लगता है कि इसमें कैप्चर प्रॉपर्टी के साथ कुछ करना है, जो बटन के लिए महत्वपूर्ण है। चरम मामलों में रिमोट डीबगर का उपयोग करना आवश्यक हो सकता है ताकि डीबगर स्वयं यूआई को प्रभावित न कर सके। यह इतना चरम मामला नहीं है, बस नोटपैड शुरू नहीं करना कामकाज है। बस मोटरिंग रखें। –