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 :

[C#] Exception dans un thread


Sujet :

C#

  1. #1
    Membre actif Avatar de padodanle51
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2006
    Messages
    389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 389
    Points : 230
    Points
    230
    Par défaut [C#] Exception dans un thread
    Bonjour, j'ai de temps en temps un exception que je n'arrive pas à cerner, ni a reproduire. Elle arrive de manière aléatoire voilà l'erreur qui est retourné:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    System.Threading.ThreadAbortException: Le thread a été abandonné.
       à System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
       à System.Windows.Forms.Form.DefWndProc(Message& m)
       à System.Windows.Forms.Control.WndProc(Message& m)
       à System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       à System.Windows.Forms.ContainerControl.WndProc(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)
    Si vous avez la moindre idée merci de m'aider

  2. #2
    Expert éminent
    Avatar de smyley
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    6 270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 6 270
    Points : 8 344
    Points
    8 344
    Par défaut
    tu n'arrètes pas ton thread quelque part genre avec un Thread.Abort ?

  3. #3
    Rédacteur
    Avatar de SaumonAgile
    Homme Profil pro
    Team leader
    Inscrit en
    Avril 2007
    Messages
    4 028
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Team leader
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2007
    Messages : 4 028
    Points : 6 334
    Points
    6 334
    Par défaut
    Est ce que tu utilises des composants tiers, des threads, etc ?

    Pour info, voici ce que dit la MSDN à ce sujet :
    When a call is made to the Abort method to destroy a thread, the common language runtime throws a ThreadAbortException. ThreadAbortException is a special exception that can be caught, but it will automatically be raised again at the end of the catch block. When this exception is raised, the runtime executes all the finally blocks before ending the thread. Since the thread can do an unbounded computation in the finally blocks, or call Thread.ResetAbort to cancel the abort, there is no guarantee that the thread will ever end. If you want to wait until the aborted thread has ended, you can call the Thread.Join method. Join is a blocking call that does not return until the thread actually stops executing.

  4. #4
    Membre actif Avatar de padodanle51
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2006
    Messages
    389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 389
    Points : 230
    Points
    230
    Par défaut
    ok merci, je vais donc voir pour éviter les thread.Abort, apparemejnt avec des booleens on pe les gérer, je vous tiens au courant
    Merci de votre aide

Discussions similaires

  1. Gérer les exceptions dans un thread
    Par Pynouz dans le forum C#
    Réponses: 5
    Dernier message: 06/10/2011, 12h29
  2. Exception dans un thread
    Par narutoe dans le forum Débuter avec Java
    Réponses: 9
    Dernier message: 18/07/2011, 23h31
  3. Récupération d'une exception dérivée dans un thread
    Par Baccs dans le forum Threads & Processus
    Réponses: 4
    Dernier message: 22/08/2008, 15h55
  4. Exception dans un thread puis NullException
    Par Nasky dans le forum Concurrence et multi-thread
    Réponses: 3
    Dernier message: 17/03/2007, 19h18
  5. Réponses: 2
    Dernier message: 28/08/2003, 00h00

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