Bonjour,
mon application gère les Exceptions de la manière suivante :
Lorsque FxCop analyse le code il indique l'anomalie suivante
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 try { ... ... } catch (Exception expt) { throw new Exception ("monMessage" + "\n" + expt.ToString(); } finally { }
FxCop m'indique de ne pas renvoyer des exceptions de type 'Exception' (car trop générales) et me conseille alors d'utiliser des exeptions plus spécifiques.User code should not create and raise exceptions of certain types that are reserved by the runtime or which are of a too general exception type. Exception types that are too general include Exception, SystemException, and ApplicationException. Exception types that are reserved by the runtime include ThreadAbortException, OutOfMemoryException, ExecutionEngineException, and IndexOutOfRangeException.
Quel type d'exception puis-je utiliser dans mon cas ?
Merci et bonne journée
Partager