Answered my own question after inspecting the exception methods, and the .NET System.Exception class. Base/Inner exception seems to be what I was mostly after: logger.debug [ "#{e.class}: #{e.message}", "Base Exception: #{e.GetBaseException}", "Inner Exception: #{e.InnerException}", "StackTrace: #{e.StackTrace}", "Source: #{e.Source}", "TargetSite: #{e.TargetSite}", "Data: #{e.Data}", "BackTrace: #{e.backtrace.join("\n")}" ].join("\n") From: s...@dev-heaven.net To: ironruby-core@rubyforge.org Date: Wed, 26 Jan 2011 13:08:29 +0000 Subject: [Ironruby-core] How to access the inner exception information from .NET exceptions?
Hi, I am wondering how I can expose the inner exception information within IronRuby. My program is throwing an exception only on one user's computer, the exception originates in a SelectItem method in WPF RibbonControlsLibrary, ComboBox. I am able to catch the exception and log it, by using a begin; (code); rescue => e; logger.debug [e.class, e.message, e.backtrace.join("\n")].join(" "); end. However this seems to only give me superficial information about exceptions thrown by .NET. I would like to be able to log all the exception information, incl each inner exception, so I can evaluate the problem and hopefully solve it. Is this possible or are there any other suggestions? Thanks for any help! This is the current exception output; System::TypeInitializationException The type initializer for 'System.Windows.Automation.InvokePatternIdentifiers' threw an exception. PresentationCore:0:in `Initialize' PresentationCore:0:in `.ctor' PresentationCore:0:in `.ctor' PresentationFramework:0:in `.ctor' RibbonControlsLibrary:0:in `.ctor' RibbonControlsLibrary:0:in `OnCreateAutomationPeer' PresentationCore:0:in `CreateAutomationPeer' PresentationCore:0:in `CreatePeerForElement' RibbonControlsLibrary:0:in `OnSelected' RibbonControlsLibrary:0:in `ChangeSelection' RibbonControlsLibrary:0:in `CoerceSelectedItem' WindowsBase:0:in `ProcessCoerceValue' WindowsBase:0:in `UpdateEffectiveValue' WindowsBase:0:in `SetValueCommon' WindowsBase:0:in `SetValue' RibbonControlsLibrary:0:in `set_SelectedItem' C:/Program Files (x86)/Six Updater/Lib/ruby/gems/1.9.1/gems/six-updater-gui-0.2.0/lib/six/updater-gui/dialog_util.rb:60:in `select_item' C:/Program Files (x86)/Six Updater/Lib/ruby/gems/1.9.1/gems/six-updater-gui-0.2.0/lib/six/updater-gui/ui_logic.rb:1124:in `load_combobox' C:/Program Files (x86)/Six Updater/Lib/ruby/gems/1.9.1/gems/six-updater-gui-0.2.0/lib/six/updater-gui/ui_logic.rb:1051:in `load_data' C:/Program Files (x86)/Six Updater/Lib/ruby/gems/1.9.1/gems/six-updater-gui-0.2.0/lib/six/updater-gui/ui_logic.rb:1051:in `each_pair' C:/Program Files (x86)/Six Updater/Lib/ruby/gems/1.9.1/gems/six-updater-gui-0.2.0/lib/six/updater-gui/ui_logic.rb:1051:in `load_data' C:/Program Files (x86)/Six Updater/Lib/ruby/gems/1.9.1/gems/six-updater-gui-0.2.0/lib/six/updater-gui/ui_logic.rb:174:in `initialize' WindowsBase:0:in `InternalRealCall' WindowsBase:0:in `TryCatchWhen' WindowsBase:0:in `InvokeImpl' WindowsBase:0:in `InvokeInSecurityContext' mscorlib:0:in `runTryCode' mscorlib:0:in `ExecuteCodeWithGuaranteedCleanup' mscorlib:0:in `RunInternal' mscorlib:0:in `Run' mscorlib:0:in `Run' WindowsBase:0:in `Invoke' WindowsBase:0:in `ProcessQueue' WindowsBase:0:in `WndProcHook' WindowsBase:0:in `WndProc' WindowsBase:0:in `DispatcherCallbackOperation' WindowsBase:0:in `InternalRealCall' WindowsBase:0:in `TryCatchWhen' WindowsBase:0:in `InvokeImpl' WindowsBase:0:in `SubclassWndProc' WindowsBase:0:in `DispatchMessage' WindowsBase:0:in `PushFrameImpl' WindowsBase:0:in `PushFrame' WindowsBase:0:in `Run' PresentationFramework:0:in `RunDispatcher' PresentationFramework:0:in `RunInternal' PresentationFramework:0:in `Run' _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core