#include <xtd/diagnostics/stack_frame>
#include <xtd/diagnostics/stack_trace>
#include <xtd/console>
void method2(int count) {
try {
if (count < 5)
console::write_line(" Stack trace for Method2: {0}", st1.to_string());
console::write_line(st.to_string());
throw;
}
}
void method1() {
try {
method2(4);
console::write_line(" Stack trace for Method1: {0}", st1.to_string());
console::write_line(st.to_string());
console::write_line(" Stack trace for next level frame: {0}", st2.to_string());
throw;
}
}
auto main() -> int {
try {
method1();
console::write_line(" Stack trace for Main: {0}", st1.to_string());
console::write_line(st.to_string());
}
console::write_line("Press Enter to exit.");
console::read_key();
}
The exception that is thrown when one of the arguments provided to a method is not valid.
Definition argument_exception.hpp:24
Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the c...
Definition stack_frame.hpp:47
Represents a stack trace, which is an ordered collection of one or more stack frames.
Definition stack_trace.hpp:40
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.hpp:18
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10