exception

Can I handle thrown exceptions in XAML?

In my XAML I get all customers by binding to a GetAll property: <ListBox ItemsSource="{Binding GetAll}" ItemTemplate="{StaticResource allCustomersDataTemplate}" Style="{StaticResource allCustomersListBox}"> </ListBox> The GetAll property is an observable collection in my view model, which calls the Model to get all collecti...

Should methods that throw RuntimeException indicate it in method signature?

For example, many methods in frameworks/JDK might throw java.lang.SecurityException but this is not indicated in the method signature (since that is a practice normally reserved for checked exceptions). I want to argue that declaring RuntimeExceptions in method sigs has many benefits (akin to static type checking for example). Am I d...

Why have a project specific RuntimeException?

Is there any point in having a com.myco.myproj.MyProjRuntimeException, which completley extends RuntimeException? ...

Anyone have issues with using a RadTextBox in a MultiView?

I am want to use a Telerik RadTextBox inside a MultiView in ASP.NET 2.0. Just dragging a RadTextBox into a view and running the page generates a run-time error of the good old favorite "Object reference nto set to an instance of an object". It seems to be breaking on the Telerik.WebControls.RadInputControl.SaveViewState() call. Has an...

.Net Exception peeking.(Update)

Hi, try { throw new Exception("test"); } finally { //Inspect the exception ???? //Log(Exception); } Is there a way to get the exception from the run-time in the finally? I cannot use a catch :-) Thanks for your answers. I cannot use a catch because its not actually my code(to refactor). We want to wrap a...

C# - Capture all unhandled exceptions automaticly with WebService

Hi, I have a C# WebService application in which I want to capture all unhandled exceptions thrown from the application. How can I do this? ...

What does the windbg command "kd" do?

I ran kd by mistake and got some output that inteerested me, a reference to a line of code in my module that I can't see on the call stack of any thread. The lines weren't the beginnning of the method so I don't think the reference is to a function pointer, but possibly the result of an exception being stored in memory??? Of course, that...

How to get the path that threw an UnauthorizedAccessException ?

Would anyone know if when you catch an UnauthorizedAccessException in C# its possible to access the path that threw it? I dont want the error message just the path that caused the problem. The try catch block I have could catch on a number of different ones but I need to report it it and continue on to the next directory/file without add...

Is there a case where a ruby "exception" would get through 'rescue Object'?

Is there a way for something to raise and exception that does not descend from Exception? What I'm trying to avoid is something like: require 'timeout' begin timeout(1) {sleep(50)} rescue StandardError => e puts e.message end I know I can catch this with 'rescue Exception' or more drastically, 'rescue Object', but that seems a li...

Can I adjust the visual studio "Break when an exception is thrown" options programatically?

Briefly: In Visual Studio 2008, the Debug menu has an Exceptions... option. When clicking this, it brings up the "Break when an exception is thrown" dialog, wherein I tick the box next to "Common Language Runtime Exceptions". I want to be able to tick / untick this box programatically. Elaboration: This causes the debugger to break w...

How do I disable rescue handlers in Ruby on Rails apps when I'm running functional tests?

I have a number of controllers in my Ruby on Rails apps with a rescue handler at the end of the action that basically catches any unhandled errors and returns some kind of "user friendly" error. However, when I'm doing rake test I'd like to have those default rescue handlers disabled so I can see the full error & stack trace. Is there an...

Should managed code return an error or throw exceptions to unmanaged code?

Hi I am about to expose a service written in C# to a legacy C++ application using COM. What is the best approach to report errors to the unmanaged client? Throwing exceptions or simply return an error value? Thanks, Stefano ...

a problem during init in constructor -- what's next?

C# noob question... I'm taking a few arguments in a class constructor to initialize some private variables. What should I do when the data passed in is not what I expect (wrong string length, numbers out of expected range, nonexisting path, stuff like that..)? Throw an exception? Add "everything went ok" flag? how is it usually done? ...

Trouble Catching a WebException

The Problem We are occasionally getting a WebException that, as hard as we try we can not seem to catch. This results in an error showing up in the event log on the WebServer. Details We have an ASP.Net application that uses several webservices. One of the webservice methods can take a long time to run. To address this we use cachi...

Exception Handling Standards Advice

In the j2ee applications I plan on standardizing the exception handling strategy. No more swallowing exceptions and basically converting all checked exceptions into unchecked (except for some that actually can be recovered from. The standard will be that all Exception will be thrown back up to the container (eg: http://www.onjava.com/pub...

How to see managed exception details in WinDBG?

VS2005 C# Compiler crashes during our team's nightly build process. I attach to it with WinDBG, load SOS extensions, print the callstack, but cannot see exception info. I tried !PrintException, as follows: 0:000> !PrintException There is no current managed exception on this thread Here's the top of callstack: 0:000> !...

Is there a Log4J Layout/Formatter that prunes Stack Traces for exceptions?

I'm looking for a Log4J Layout/Formatter that helps me prune stack-traces in exceptions a little better than the defaults. That the stack-execution is somewhere below main() is quite obvious and unnecessary for me to know, and that the exception occurred deeply within some other library is really nothing I can do too much about. What I ...

Can I have strong exception safety and events?

Suppose I have a method which changes the state of an object, and fires an event to notify listeners of this state change: public class Example { public int Counter { get; private set; } public void IncreaseCounter() { this.Counter = this.Counter + 1; OnCounterChanged(EventArgs.Empty); } protected virtual vo...

Java Exception vs C++ Exceptions

Where are exceptions stored ? Stack, Heap. How is memory allocated and deallocated for Exceptions? Now if you have more than one exception which needs to be handled are there objects of all these exceptions created? ...

Throwing Destructors, Memory Corruption?

We have a class whose semantic behaviour is like the following :- struct Sample { ~Sample() throw() { throw 0; } }; void f () { try { delete new Sample; } catch (...){ } } I know that throwing exceptions in dtors is evil; but the relinquishment of a 3rd Party library resource is throwing an exception (but can...