exception

Cannot get the Exception Assistant to work

I have a C# WPF app that makes use of a number of assemblies that use native code. My problem is that most of the time, when my application throws an exception, the Exception Assistant does not come up - just the Break/Continue/... dialog. I of course have the Exception Assistant turned on in the Visual Studio options, and I have the par...

HRException on startup of my C# WPF app

I have a C# WPF application that is suddenly throwing an exception on startup, and I cannot figure out why. The exception is a C++ HRException, and it occurs in MSCORLIB in CreateInstanceSlow(), which is called from CreateInstance(), which is called from BamlRecordReader.CreateInstanceFromType() in the System.Windows.Markup assembly. I m...

NoSuchTableException being thrown from dbunit test cases

I'm trying to fix the test suite on an project which I've inherited from another programmer for some java database code. The project itself is using hibernate and MySQL for the DB stuff, but for the purposes of the test cases dbunit is being used. I can correctly load and initialize hibernate's session factory, but I keep getting excep...

What is a "first chance exception"?

What exactly is a first chance exception? How and where does it originate in a .Net program? And why is it called by that peculiar name (what 'chance' are we talking about)? ...

Can you set VS2008 to break on an error inside a try-catch statement

One of the things I loved about VB6 is that you had the ability to tell the development environment to break on all errors regardless of what error handling you had set up. Is it possible to do the same thing in VS2008 so that the debugger will stop on any error even if it happens inside a try-catch statement? The problem is particular...

Object reference not set to an instance of an object

I am seeing following exception. System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.Util.StringUtil.memcpyimpl(Byte* src, Byte* dest, Int32 len) at System.Web.Util.StringUtil.UnsafeStringCopy(String src, Int32 srcIndex, Char[] dest, Int32 destIndex, Int32 len) at System.Web.HttpW...

How expensive are Exceptions

Do you know how expensive exception throwing and handling in java is? We had several discussions about the real cost of exceptions in our team. Some avoid them as often as possible, some say the loss of performance by using exceptions is overrated. Today I found the following piece of code in our software: private void doSomething() {...

NHibernate - not-null property reference a null or transient value

I'm getting this exception (Full exception at the bottom): NHibernate.PropertyValueException was unhandled by user code Message="not-null property references a null or transient valueClearwave.Models.Encounters.Insurance.Patient" Source="NHibernate" EntityName="Clearwave.Models.Encounters.Insurance" PropertyName="Patient" I've don...

Exception catching best practice (c#/.net)

If I have code like this: void a() { try { b(); } catch (MyException) { // Handle any problems that occurred in b(c(d())) } } void b() { c(); // Do something else } void c() { d(); // Do something else } void d() { // Do something, throw a MyException if it fails } Assumin...

Can JScript.NET distinguish different .NET exception types

I'm using JScript.NET to write scripts in a C# WinForms application I wrote. It works really well, but I just tried putting some exception handling in a script, and I can't figure out how to tell what type of exception was thrown from my C# code. Here's some example JScript code that throws two different types of CLR exception, and then...

Where do uncaught exceptions go with asynchronous I/O

I am developing a console-based .NET application (using mono). I'm using asynchronous I/O (Begin/EndReceive). I'm in the middle of a callback chain several layers deep, and if an exception is thrown, it is not being trapped anywhere (having it bubble out to the console is what I would expect, as there is currently no exception handling...

Multipule Operations in a finally block

Lets say you had some resource clean up like: This is C#. try{/*stuff*/} catch(Exception e) {/*rollback logs etc.*/} finally{ if( context.Transaction != null ) context.Transaction.Dispose(); context.Connection.Close(); context.Connection.Dispose(); } Would it be more robust to do this instead? try{/*stuff*/} catch(Exception e) {...

Python: How to ignore an exception and proceed?

I have a try...except block in my code and When an exception is throw. I really just want to continue with the code because in that case, everything is still able to run just fine. The problem is if you leave the except: block empty or with a #do nothing, it gives you a syntax error. I can't use continue because its not in a loop. Is the...

Handling fpu exception on windows

I would like to handle fpu exception on windows, something like: #include <math.h> #include <fenv.h> #include <stdio.h> int main() { double b = 0; int raised; feclearexcept (FE_ALL_EXCEPT); b /= 0; raised = fetestexcept (FE_OVERFLOW | FE_INVALID); if (raised & FE_OVERFLOW) { printf("over\n");} if (raised & F...

Is "Dying is Awesome" preferred?

Recently I attended Jeffrey Richter's training courses about .NET. He mentions one strategy of coding "Dying is awesome". That is, don't write "catch (Exception ex)" even at the root of program or event loop. If some exception thrown that is not handled, just let the process die. I'm not sure this is right. Personally, I prefer to have...

Response.Redirect - using exceptions for flow control?

Response.Redirect has two overloads: public void Redirect(string url) Parameters: url: The target location. public void Redirect(string url, bool endResponse) Parameters: url: The location of the target. endResponse: Indicates whether execution of the current page should terminate. If I call the first overload, or call the second wit...

Creating new exception in C++

Hello, I have a c++ class and I am trying to run it in ubuntu: #ifndef WRONGPARAMETEREXCEPTION_H_ #define WRONGPARAMETEREXCEPTION_H_ #include <iostream> #include <exception> #include <string> using namespace std; #pragma once class WrongParameterException: public exception { public: WrongParameterException(char...

Unhandled ThreadAbortException occuring - sometimes

Hello! I have a dialog that has to process large quantaties of data (the procedure is quite time consuming - first the ODBC fill takes its time, then the data processing kicks in) and the result is that the Form becomes unresponsive. This is not a problem really, it is enough to just open a "loading screen" in a new thread to notify the...

Why can't a null-reference exception name the object that has a null reference?

It seems to me that a lot of my debugging time is spent chasing down null-reference exceptions in complex statements. For instance: For Each game As IHomeGame in _GamesToOpen.GetIterator() Why, when I get a NullReferenceException, can I get the line number in the stack trace, but not the name of the object that equals null. In other w...

VB.NET Continuously Adding One to a Text Box

I am trying to create a program that has a button and a text box. Everytime the button is pushed I want it to add one to the text box. I keep getting this error: Overload resolution failed because no accessible 'Int' accepts this number of arguments Also I am a huge n00b. Here is where I am at so far, thanks in advance. Optio...