exception

runtime error when calling a C++ dll from C# .NET windows application

I had a C# .NET windows application having C# user interface and all the code behind processing is done by calling C++ dll (C++ class library project) which is added as a reference to the C# project. However recently when I formatted my computer and again tried to run my project which was backed up, in visual studio 2005 it gave the fol...

auto-document exceptions on methods in C#/.NET

I would like some tool, preferably one that plugs into VS 2008/2010, that will go through my methods and add XML comments about the possible exceptions they can throw. I don't want the <summary> or other XML tags to be generated for me because I'll fill those out myself, but it would be nice if even on private/protected methods I could ...

C++ - Where to throw exception?

Hello! I have some kind of an ideological question, so: Suppose I have some templated function template <typename Stream> void Foo(Stream& stream, Object& object) { ... } which does something with this object and the stream (for example, serializes that object to the stream or something like that). Let's say I also add some plain wr...

[C++] which is better, throw an exception or return nonzero value?

Possible Duplicate: C++ - Arguments for Exceptions over Return Codes While you are doing C++ programming, you have two choices of reporting an error. I suppose many teachers would suggest you throw an exception, which is derived from std::exception. Another way, which might be more "C" style, is to return a non-zero value, as ...

How to get full callstack of FaultException

Hi, I have a WCF service that throws an exception. I get a FaultException in the client without an InnerException. I only have part of the callstack of the original exception, from which it's hard to understand what caused this. How do I get the original exception or at least all the callstack? Thanks. ...

How to differentiate between exceptions i can show the user, and ones i can't?

i have some business logic that traps some logically invalid situations, e.g. trying to reverse a transaction that was already reversed. In this case the correct action is to inform the user: Transaction already reversed or Cannot reverse a reversing transaction or You do not have permission to reverse transactions or ...

Distinguishing between .NET exception types

For the love of all things holy, how do you distinguish between different "exception flavors" within the predefined .NET exception classes? For example, a piece of code might throw an XmlException under the following conditions: The root element of the document is NULL Invalid chars are in the document The document is too long All o...

How can I make Ruby rake display the full backtrace on uncaught exception

As you may know rake swallows the full backtrace on uncaught exception. If I want to have a full backtrace, I need to add the --trace option. I find this very annoying because some of my tasks take long time to run (up to 6 hours), when it crashes I don't have any debugging info. I need to run it again with the --trace. On top of that,...

vb.net documentation and exception question

Let's say I have this sub in vb.net: ''' <summary> ''' Validates that <paramref name="value"/> is not <c>null</c>. ''' </summary> ''' ''' <param name="value">The object to validate.</param> ''' ''' <param name="name">The variable name of the object.</param> ''' ''' <exception cref="ArgumentNullExcepti...

Set reference = null in finally block?

A colleague of mine sets reference to null in finally blocks. I think this is nonsense. public Something getSomething() { JDBCConnection jdbc=null; try { jdbc=JDBCManager.getConnection(JDBCTypes.MYSQL); ... } finally { JDBCManager.free(jdbc); jdbc=null; // <-- Useful or not? } } What...

Asp.net HttpWebResponse - how can I not depend on WebException for flow control?

I need to check whether the request will return a 500 Server Internal Error or not (so getting the error is expected). I'm doing this: HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Method = "GET"; HttpWebResponse response = request.GetResponse() as HttpWebResponse; if (response.StatusCode == HttpStatusC...

Handling unexpected end of requests in servlets

Hi, I am currently developing a REST web service with Jersey / Tomcat (but a generic Servlet/Container answer is welcome). If the client does some GET requests on services that return large amount of data, from a MySQL connection. To avoid any OOM exception, I use a streaming mode for MySQL. However, if the client aborts the request ...

Very strange Application.ThreadException behaviour.

I'm using the Application.ThreadException event to handle and log unexpected exceptions in my winforms application. Now, somewhere in my application, I've got the following code (or rather something equivalent, but this dummy code is enough to reproduce my issue) : try { throw new NullReferenceEx...

Resuming execution of code after exception is thrown and caught

Hi, How is it possible to resume code execution after an exception is thrown? For exampel, take the following code: namespace ConsoleApplication1 { class Test { public void s() { throw new NotSupportedException(); string @class = "" ; Console.WriteLine(@class); ...

f# interactive System.OutOfMemoryException

f# interactive throws System.OutOfMemoryException when loading large objects into memory. Exception is thrown at approximately 1.3 gigs. Data set is 2.2 gigs, and loads fine in debugger mode. Using VS2008 with April 2010 CTP This is mostly a java library that is being used via ikvmc, but if that were an issue, it shouldn't be running ...

VB.NET - Object reference not set to an instance of an object

I need some help with my program. I get this error when I run my VB.NET program with a custom DayView control. ***** Exception Text ******* System.NullReferenceException: Object reference not set to an instance of an object. at SeaCow.Main.DayView1_ResolveAppointments(Object sender, ResolveAppointmentsEventArgs args) in C:\Us...

Autonumber with Entity Framework

I want to loop through a collection of objects and add them all to a table. The destination table has an auto-increment field. If I add a single object there is no problem. If I add two objects both with the primary key of zero, the entity framework fails. I can manually specify primary keys but the whole point of trying the EF was t...

Unhandled Exception: C# RESTful Webservice

Hi, I am trying a simple C# Restful Webservice example. I have the service running. I create a console client to test the Webservice, i get the following exception: Unhandled Exception: System.ServiceModel.CommunicationException: Internal Server Error Server stack trace: at System.ServiceModel.Dispatcher.WebFaultClientMessageInspec...

.NET 2.0 vs .NET 4.0 loading error

My class library is compiled against .NET 2.0 and works just fine whenever I try to load it as a plugin under the 2.0 runtime. If however the master application is running the .NET 4.0 runtime, I get an exception as soon as the resources need to be accessed: Exception occurred during processing of command: Grasshopper Plug-in = Grasshop...

Thread.abort_on_exception doesn't work in rake task?

When I run Thread.abort_on_exception = true threads = [] threads << Thread.new do loop { sleep 1 } end threads << Thread.new do loop { sleep 1; raise } end threads.each { |t| t.join } as a straight-up ruby script, the script exits as you'd expect with abort_on_exception set to true. But when I try to run this same code as a ra...