J'ai une application Windows très simple, avec quelques contrôles, un contrôle DataGridView et le visualiseur Adobe PDF. L'application fonctionne bien, sauf lorsque vous basculez pour basculer entre les contrôles, je reçois régulièrement l'exception suivante.Exception de changement de focus avec la touche de tabulation dans une application .NET
System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.AxHost.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(Int32 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(Form mainForm)
at Scan_Manager.Program.Main() in D:\Checkouts\Code\Scan Manager\Scan Manager\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(Assembly 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.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Quelqu'un me pointe dans la bonne direction?
Merci, Jon
Mise à jour
Après avoir joué un peu plus, il ne se produit que lorsque le contrôle Adobe perd le focus. Je peux contourner quelque peu en désactivant son Tabstop, mais malheureusement lorsque j'utilise LoadFile pour charger un PDF, il se concentre automatiquement (et l'application se bloque lorsque je tabule)
Est-ce que cela arrive sans le contrôle Adobe? –
Non - et après avoir joué un peu plus, cela ne se produit que lorsque le contrôle Adobe perd le focus. Je peux contourner quelque peu en désactivant son Tabstop, mais malheureusement quand j'utilise LoadFile pour charger un PDF, il obtient automatiquement le focus (et puis l'application se bloque lorsque je tabule). – Jon
Cela ressemble à un bug Adobe. Vous voudrez peut-être leur demander. –