2
I realized that in some requisitions the output of mine Visual Studio displays some messages such as this:
Exception generated: 'System.Collections.Generic.Keynotfoundexception' in mscorlib.dll
Generated exception: 'System.Nullreferenceexception' in Siteteste.dll
Follows the Printscreen of errors in output
Some exceptions are displayed to class/line that the error happened, but looking at these I stay in the dark. How can I know in which part of the system these errors are happening?
There is an attribute in Exception called Stacktrace, it shows where the error occurred and its propagations
– Guilherme Barros
@Guilhermebarros but these exceptions are happening and the program is not stopping (as when an Exception happens), it skips the Exception knows? just log on the output and more nd...
– Leonardo Bonetti
Dude, in actions it’s interesting to cover the actions with Try catch and then capture the exceptions and, as you want to display Stacktrace of the exceptions on the console, you will use Console.Writeline(ex.Message) and Console.Writeline(ex.Stacktrace) and then throw again
– Guilherme Barros