exception

Silverlight 2 Webservices

Hi, I'm developing a silverlight application that consumes a webservice. Calls to this webservice are made Asynchronously. But when an exception occurs during a procedure of the async call, I get an error on the completed event but i lost my original exceptions information. Independent of what the original exception was, I always get "...

AppDomain.CurrentDomain.UnhandledException not firing without debugging

Hi, I have a .NET program with an event handler bound to Application.CurrentDomain.UnhandledException. When running the program with debugging, this event fires when an unhandled exception is thrown. However, when running without debugging, the event does not fire. What is my problem? Thanks, Andrew ...

iPhone dev - NSInternalInconsistencyException help?

2009-08-19 11:00:06.482 Pickers[26090:20b] *** Assertion failure in -[UIDatePickerView _updateBitsForDate:andReload:animateIfNeeded:], /SourceCache/UIKit/UIKit-963.10/UIDatePicker.m:908 2009-08-19 11:00:06.483 Pickers[26090:20b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter n...

Can you rethrow a c# exception on a different thread?

Is it legal and safe in C# to catch an exception on one thread, and then re-throw it on another. E.g. is this legal Exception localEx = null; Thread mythread = new Thread() { () => { try { DoSomeStuff(); } ...

API design: Adding a new exception type - is it safe?

Hi All, I need to change an existing service API to throw an extra exception for a scenario. The exception will be a subtype of an already thrown exception. Is it okay to do this or will it be considered backwards incompatible? I have the interface in a separate jar, so if my service throws this new exception which is a child of the al...

Catching default exceptions in C++

I was just wondering if a system exception like say divide by zero actually "throws" something to the application. Would it be possible to catch this somehow by default?. i mean we can define a custom divide fn which checks for null divisor and throws an exception, but just thought it would be nice if this exception was thrown by defaul...

Does the memory get released when I throw an exception?

Hi, I was debating with some colleges about what happens when you throw an exception in a dynamically allocated class. I know that malloc gets called, and then the constructor of the class. The constructor never returns, so what happens to the malloc? Consider the following class B { public: B() { cout << "B::B()" ...

Which is better/more efficient: check for bad values or catch Exceptions in Java

Which is more efficient in Java: to check for bad values to prevent exceptions or let the exceptions happen and catch them? Here are two blocks of sample code to illustrate this difference: void doSomething(type value1) { ResultType result = genericError; if (value1 == badvalue || value1 == badvalue2 || ...) { resul...

In which language did exceptions first appear?

I first came across exceptions with ADA 83. As far as I know, the designers of ADA invented the concept of exceptions. Is this true, or did any programming language that came before use exceptions too? ...

Windows Forms Application Exceptions Trapping

Is there an elegant way to trap all unhandled exceptions in a Windows Form application? I would like to handle them and write them to a log file. I know ASP.NET has one. I'm using C#. ...

How can I add logic to an existing dependency-property callback?

I'm trying to add a PropertyChangedCallback to UIElement.RenderTransformOriginProperty. An exception is thrown when I try to override the PropertyMetadata. I have searched MSDN and Google, and all I have been able to come up with is this. DependencyPropertyDescriptor.AddValueChanged is suggested at some point in that post, but that wo...

Bad Re-throw compiles but crash at runtime

Following code will compile but crash at run time: int main() { try { throw; } catch(...){ cout<<"In catch"; } return 0; } Result: “Unhandled exception at 0x7c812a5b in hello.exe: Microsoft C++ exception: [rethrow] @ 0x00000000” Why compiler allows the code to compile? it looks not so difficult ...

How do you implement IDataRecord properly if IndexOutOfRangeException is a reserved exception type?

According to the documentation for IDataRecord, the implementing methods must throw IndexOutOfRangeException if the field index is out of the range of fields. However, if you try to throw an IndexOutOfRangeException directly in code, FXCop complains that it is a reserved exception type. How do you keep to the IDataRecord exception contra...

In Java, why do Exception classes need to be available to the classloader before they're necessary?

I'm developing an application that dynamically loads a JAR, which contains the definition of a bunch of classes it uses. Everything went fine until I tried to catch an Exception-derived class that's in the dynamically loaded JAR. The following snippet shows the issue (DynamicJarLoader is the class which actually loads the JAR; both Test...

when is it necessary to add an `else` clause to a try..except in Python?

When I write code in Python with exception handling I can write code like: try: some_code_that_can_cause_an_exception() except: some_code_to_handle_exceptions() else: code_that_needs_to_run_when_there_are_no_exceptions() How does this differ from: try: some_code_that_can_cause_an_exception() except: some_code_to_h...

Error setting property on CLLocation subclass

I've defined this subclass of CLLocation MyLocation.h @interface MyLocation: CLLocation { NSString *datum; NSString *ellipsoid; } @property(nonatomic,retain) NSString *ellipsoid; @property(nonatomic,retain) NSString *datum; MyLocation.m @synthesize datum,ellipsoid; Now i get a CLLocation instance through the location mana...

External exception C0000006

Hello, I've wrote some program in Delphi and when I am running it from a disk on key. At some point I'm required to unplug the disk on key while the application is running. If I do this on a computer with at least 1gb of ram everything is okay. When I do this on a machine with 512mb I get an external exception C0000006. If I'm not mista...

How do I test an exception that is only thrown when the system path is wrong?

I have the following class in C# which creates an object from a propriatery .DLL that requires a license in a reachable directory at the initialization . public CplexServices{ private Cplex _cplex; public Cplex Cplex { get { return _cplex; } } public CplexServices() { try { _cplex = new Cplex(...

"Safe handle has been closed" with SerialPort and a thread in C#

Good afternoon everybody! I have this threaded SerialPort wrapper that reads in a line from the serial port. Here is my thread's code. protected void ReadData() { SerialPort serialPort = null; try { serialPort = SetupSerialPort(_serialPortSettings); serialPort.Open(); string data; whi...

Problem with Bitmap Cloning

Consider this code for loading, modifying and saving a Bitmap image: using (Bitmap bmp = new Bitmap("C:\\test.jpg")) { bmp.RotateFlip(RotateFlipType.Rotate180FlipNone); bmp.Save("C:\\test.jpg"); } it runs without any exception. But consider this one: using (Bitmap bmp = new Bitmap("C:\\test.jpg")) ...