exception

Ignore exceptions that cross AppDomains when debugging in Visual Studio 2010

I'm having problems with debugging an application that calls out to another AppDomain, because if an exception occurs in whatever the other AppDomain is doing, the exception bubbles up and causes Visual Studio 2010 to break no matter what. I've properly wrapped the method call that throws in a try/catch, and the exception is properly ca...

Troubleshooting MySQLIntegrityConstraintViolationException

I have a closed-source upgrade application which migrates my database from an old format to a new format (creates new tables and migrates data from the old to new tables). The application crashes with a MySQLIntegrityConstraintViolationException. It doesn't give me the name of the table with the primary key violation or the contents of ...

Random TransformerException, how to solve it?

My app writes a lot of XML data, and randomly the last line of the following piece of code: // Prepare the DOM document for writing Source source = new DOMSource(node); // Prepare the output stream Result result = new StreamResult(stream); // Write the DOM document to the file Transformer xformer = TransformerFactory.newInstance().new...

Exception not throwing (in Win7?)

Hi I have application reads in data from text file. Recently I realized that I should make a data checker for the data in the text file, to see if I can display/handle it correctly. Basically at the moment all the checker does is see if data is in the correct format, i.e. double is a double, int is int, etc... And if it isn't I'm thro...

Setting the detail field of a `FaultException` without object serialization

I'm trying to adapt a framework originally written for WSE to WCF. The framework sometimes throws SoapExceptions from deep in its bowels, which I would like to catch and transform into FaultException objects that the WCF framework will handle. In order for the existing clients of this framework to continue working, I need the <detail> f...

Returning after throwing exceptions

Is it in any way beneficial to return a value after throwing an exception? If not, can the return statement be left out and is it somehow possible to remove compiler error C4715: not all control paths return a value? Thanks in advance. Edit: (sample code) for (ushort i = 0; i < itsNumUnits; ++i) if (unitFormation[i] == unit) {...

NHibernate.MappingException: An association from the table table refers to an unmapped class: Int32

Hi, im starting whit Nhibernate and have managed to get a few examples working, but now the aplication im makin throws this exeption when Nhibernate load the configuration. NHibernate.MappingException: An association from the table TBL_MARCADAS refers to an unmapped class: Int32 at NHibernate.Cfg.Configuration.SecondPassCompileForeign...

Why exceptions are not propagated by WPF Dispatcher.Invoke?

Here's my hypothetical example. I have a very simple WPF window with a one Button. The Button.Click event has a handler that goes like this. Action doit = () => { Action error = () => { throw new InvalidOperationException("test"); }; try { this.Dispatcher.Invoke(error, DispatcherPriority.Normal); } catch (Exception ...

Raising events in C# that ignore exceptions raised by handlers

One of my pet peeves with raising events in C# is the fact that an exception in an event handler will break my code, and possibly prevent other handlers from being called, if the broken one happened to get called first; In most cases my code couldn't care less if somebody else's code that's listening to its events is broken. I created a...

Is there a nice way to handle exceptions in Python?

I have a bunch of code that looks similar to this: try: auth = page.ItemAttributes.Author except: try: auth = page.ItemAttributes.Creator except: auth = None Is there a nicer w...

Should event handlers in C# ever raise exceptions?

As a general rule, are there ever any circumstances in which it's acceptable for a method responsible for listening to an event to throw an exception (or allow to be thrown) that the class raising the event will have to handle? Given that such an exception would stop other listeners to that event from being called subsequently, it seems...

Exception pages in development mode take upwards of 15-30 seconds to render, why is that?

I am using Rails 3 beta 4 and for some reason I have each exception taking 15-30 seconds to show. Here is my trace: Started GET "/something/something/approvals/new" for 127.0.0.1 at Thu Jun 24 21:17:12 -0400 2010 SQL (1.8ms) describe `approvals_users` SQL (24.6ms) describe `clients_users` SQL (1.4ms) describe `agencies_users` ...

Exception seems to kill updating of a JList

I'm using an ActionListener to update a JList whenever an item is selected. jComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); updateLocalFileList( cb.getSelectedItem().toString() ); } }); It is calling this method for the UI...

What is the Purpose of exceptions ?

Could you explain the concept of exceptions in C#? ...

in a try-block, how to do sth. if no exception occurs ? obj-c

in a standard try-catch-error-block, how can i advice the programm to do something only, if no error is thrown ? for example, if i want to configure a proxy for something ip-based, and if it all works, it should grey-out the button. ...

PHP __toString does not work with trigger_error as advertised

It is known that __toString cannot throw an exception but I have read ( Link 1, Link 2 ) that it supports trigger_error so I tried the following code: public function __toString() { try { return $this->render(); } catch (Exception $e){ trigger_error($e->getMessage()); return ''; ...

Out of memory error while loading a Bitmap

Hello everybody, I'm working with big size images (for ex. 16000x9440 px) and cut some regions for other things. I'm getting an exception "Out of memory" when create a new Bitmap instance: using (FileStream fileStream = new FileStream(mapFileResized, FileMode.Open)) { byte[] data = new byte[fileStream.Length]; fileStream.Read(d...

NUnit tests: Is IDisposable guaranteed if a non-expected exception is thrown?

If I create an IDisposable during the TestFixtureSetup of an NUnit test, and the test throws an unanticipated exception (e.g. external resource fails), will the IDisposable's Dispose() get called? Added>> If not, does NUnit provide guaranteed execution of TestFixtureTearDown or somewhere else that can be used for cleanup? ...

How can I trace where potential exceptions might be thrown from?

We have many questions here about stack traces and analyzing exceptions that have been thrown. I am using RedGate Reflector to examine the workings of some .net classes. In particular, I am looking at the ConnectionString property of the System.Data.SqlClient.SqlConnection object. Reflector indicates that this property may throw an Ar...

Dll built in Delphi 2010/2009 not compatible to Delphi 7 when an Exception is raised.

Hello guys, I've built a dll in Delphi 2010 and it's consumed in my delphi 7 application. I'm aware of the unicode AnsiString / string matter and according to my tests everything works fine up to the moment that no exception is raised by my delphi 2010 dll. The fact is, is there any special/treated exception that is compatible to the...