Bonjour,

j'ai une erreur que je n'ai sais pas résoudre parce que je ne sais pas vraiment ce qui se passe, et surtout je n'arrive pas à la reproduire ( elle n'a lieu qu'en production, heureusement elle est assez rare ).
la pile n'aide pas beaucoup :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Stack :    à System.Windows.Media.Visual.AddVisualChild(Visual child)
   à System.Windows.FrameworkElement.set_TemplateChild(UIElement value)
   à System.Windows.StyleHelper.AddCustomTemplateRoot(FrameworkElement container, UIElement child, Boolean checkVisualParent, Boolean mustCacheTreeStateOnChild)
   à System.Windows.Controls.ContentPresenter.UseContentTemplate.BuildVisualTree(FrameworkElement container)
   à System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   à System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   à System.Windows.FrameworkElement.ApplyTemplate()
   à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   à System.Windows.UIElement.Measure(Size availableSize)
   à System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   à System.Windows.UIElement.Measure(Size availableSize)
   à System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   à System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   à System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   à System.Windows.UIElement.Measure(Size availableSize)
   à System.Windows.ContextLayoutManager.UpdateLayout()
   à System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   à System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   à System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   à System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   à System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   à System.Windows.Threading.DispatcherOperation.InvokeImpl()
   à System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   à System.Threading.ExecutionContext.runTryCode(Object userData)
   à System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Windows.Threading.DispatcherOperation.Invoke()
   à System.Windows.Threading.Dispatcher.ProcessQueue()
   à System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   à System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   à System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   à System.Windows.Forms.SafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type)
   à System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
   à System.Windows.Forms.MessageBox.Show(String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
   à Mxx.frFiche.frFiche_FormClosing(Object sender, FormClosingEventArgs e) dans C:\projets2\sources\Mxx\Mxx\frFiche.cs:ligne 1053
   à System.Windows.Forms.Form.OnFormClosing(FormClosingEventArgs e)
   à System.Windows.Forms.Form.WmClose(Message& m)
   à System.Windows.Forms.Form.WndProc(Message& m)
   à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
on sait que cela se passe ligne 1053. voici le code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  private void frFiche_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (bModif)
            {
                if (Convert.ToInt32(MgaUtil.iniRead("APP_LOADED", "MT1", "0", frMain.sFileMgaIni)) == 1)
                {
                    //Vérifie s'il y a des doc en cours attachés à la fiche
                    sListeMtxDoc = "***";
                    frMain.doGetMainAppForMtx().MgaMessageSend(new MgaMessage(this, "MT1_GET_ATTACHED_DOC", this.idFiche));
                    while (sListeMt1Doc == "***")
                    {
                    }
                    //if(sListeMt1Doc != "***")
                    if (sListeMt1Doc != "")
                    {
                        frMain.dbData.mainApp.MgaMessageSend(new MgaMessage(this, "APP_SELECT", "Mxx"));
                        frMain.thisMain.Refresh();
                        frMain.thisMain.Select();
                        //Application.DoEvents();
                        MessageBox.Show("Veuillez d'abord fermer le(s) document(s) ci-dessous, relatif(s) à ce dossier :\r\n\r\n" + sListeMt1Doc, "Fermeture du dossier", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        frMain.dbData.mainApp.MgaMessageSend(new MgaMessage(this, "APP_SELECT", "MT1"));
                        e.Cancel = true;
                    }
                }
                if (!e.Cancel)
                {
                    Control aCtl = this.ActiveControl;
                    DialogResult dRes = MessageBox.Show("Voulez-vous enregistrer les modifications avant de fermer ?", "Fermeture de la fiche", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
                    this.Refresh();
                    if (aCtl != null)
                        aCtl.Select();
                    switch (dRes)
                    {
                        case DialogResult.Cancel:
                            e.Cancel = true;
                            break;
                        case DialogResult.Yes:
                            if (!doSave())
                                e.Cancel = true;
                            break;
                        default:
                            break;
                    }
                }
            }
        }
la ligne 1053 est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
DialogResult dRes = MessageBox.Show("Voulez-vous enregistrer les modifications avant de fermer ?", "Fermeture du dossier", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
je précise que c'est le code d'une application dont j'ai repris le suivi.

j'ai essayé des tas de fois de reproduire l'erreur, en essayant de reproduire les manipluations des clients, mais, chez moi ça fonctionne...
il s'agit d'un module F2, docké dans une windowFormHost...

Quelqu'un aurait une idée ? une piste ?
Merci d'avance...