IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Application.Restart() Collection was modified; enumeration operation may not execute.


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Juin 2009
    Messages
    106
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 106
    Par défaut Application.Restart() Collection was modified; enumeration operation may not execute.
    Salut svo qui m'indiquer la cause de cette exception qui apparet lorsque je fait: Application.Restart()

    Voila stackcall:

    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
    52
    53
    54
    System.InvalidOperationException was unhandled
      Message=Collection was modified; enumeration operation may not execute.
      Source=mscorlib
      StackTrace:
           at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
           at System.Windows.Forms.Application.ExitInternal()
           at System.Windows.Forms.Application.Restart()
           at H.FRM_MConfig.BTN_Enregistrer_Click(Object sender, EventArgs e) in D:\H\FRM_MConfig.cs:line 122
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           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.RunDialog(Form form)
           at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
           at System.Windows.Forms.Form.ShowDialog()
           at H.MDIParent.MDIParent_Load(Object sender, EventArgs e) in D:\H\MDIParent.cs:line 844
           at System.Windows.Forms.Form.OnLoad(EventArgs e)
           at System.Windows.Forms.Form.OnCreateControl()
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl()
           at System.Windows.Forms.Control.WmShowWindow(Message& m)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at System.Windows.Forms.Form.WmShowWindow(Message& m)
           at System.Windows.Forms.Form.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.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
           at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
           at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
           at System.Windows.Forms.Control.set_Visible(Boolean value)
           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 H.Program.Main() in D:\H\Program.cs:line 95
           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.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:
    Merci de votre attention

  2. #2
    olf
    olf est déconnecté
    Membre actif
    Profil pro
    Inscrit en
    Août 2004
    Messages
    26
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2004
    Messages : 26
    Par défaut
    Bonjour,

    Il est difficile de trouver la cause de l'erreur sans avoir le code sous les yeux.

    Néanmoins, il est écrit très clairement dans l'extrait de la stackcall que le "plantage" est dû au fait qu'une "Collection" que vous êtes en train de parcourir a été modifiée.

    En lisant la stackcall, je suppose également que cette Collection est une ArrayList (ou un type plus dérivé ?).

    En utilisant le debugger avec un point d'arrêt sur Application.Restart(), il devrait être possible de trouver sur quelle instruction exactement le problème survient, et d'en déduire la Collection concernée.

    Enfin, il faudra comprendre où et comment cette collection a été modifiée.

    Cordialement,

    Florian.

Discussions similaires

  1. Réponses: 2
    Dernier message: 06/07/2009, 14h55
  2. Tests automatiques de mon application GTK sans la modifier
    Par j0n47h4n dans le forum GTK+ avec C & C++
    Réponses: 0
    Dernier message: 02/01/2009, 16h28
  3. Application.Restart ne fonctionne plus
    Par Ishizaki dans le forum Windows Forms
    Réponses: 4
    Dernier message: 23/05/2008, 15h54
  4. Deploiment d'une application web sur WAS
    Par menzlitsh dans le forum Websphere
    Réponses: 1
    Dernier message: 06/07/2007, 15h48
  5. [Tomcat]WebappClassLoader: Resource '...' was modified :(
    Par iubito dans le forum Eclipse Java
    Réponses: 3
    Dernier message: 14/02/2005, 10h52

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo