exception-handling

Pros and Cons of developing/using Attribute Classes to handle exceptions in a .NET Code?

Hi all, I would like to pose a question about developing and using attribute classes in your code. I'm quite a newbie in developing attribute classes (it is an uncharted territory on my book!), and was thinking of creating an attribute class that will handle exceptions in methods instead of coding a try/catch() method in each method or...

Unable to catch c++ exception using catch (...)

I have a third-party library that is sometimes throwing an exception. So I decided to wrap my code in a try/catch(...) so that I could log information about the exception occurring (no specific details, just that it happened.) But for some reason, the code still crashes. On client computers, it crashes hard and the code to log the e...

Why are my C++ exceptions not being caught?

I have some C++ code that uses a very standard exception pattern: try { // some code that throws a std::exception } catch (std::exception &e) { // handle the exception } The problem is that the exceptions are not being caught and I cannot figure out why. The code compiles to a static library in OS X (via Xcode). The library is l...

How to deal with not knowing what exceptions can be raised by a library method in Ruby?

This is somewhat of a broad question, but it is one that I continue to come across when programming in Ruby. I am from a largely C and Java background, where when I use a library function or method, I look at the documentation and see what it returns on error (usually in C) or which exceptions it can throw (in Java). In Ruby, the situa...

UnauthorizedAccessException cannot resolve Directory.GetFiles failure

Hi all, Directory.GetFiles method fails on the first encounter with a folder it has no access rights to. The method throws an UnauthorizedAccessException (which can be caught) but by the time this is done, the method has already failed/terminated. The code I am using is listed below: try { // looks in stat...

Use single Elmah.axd for multiple applications with single DB log

We have a single SQL Log for storing errors from multiple applications. We have disabled the elmah.axd page for each one of our applications and would like to have a new application that specifically displays errors from all of the apps that report errors to the common SQL log. As of now, even though the application for all errors is u...

Disable EXCEPTION_DEBUG_EVENT from being passed to an attached debugger

I'm dealing with an anti-debug application which disables EXCEPTION_DEBUG_EVENT from being passed to my debugger, instead it executes its SEH and UnhandledExceptionFilters. I tried it with 3 different debuggers (even selfmade one) My debugger receives other debug events like LOAD_DLL, CREATE_THREAD etc Exceptions are not passed when fi...

Can MS Enterprise Library Logging be used for multiple applications?

I'm wondering if its - a) possible; b) good practice - to log multiple applications to single log instance? I have several ASP.NET apps and I would like to aggregate all exceptions to a centralized location that can be queried as part of an Enterprise Dashboard app. I'm using both the EL logging block and the EL exception blog along wi...

How can I use Directory.GetFiles skipping UnauthorizedAccessException?

When I use System.IO.Directory.GetFiles method in C:\, an error is raised: Access to the path 'c:\System Volume Information' is denied. How can I handle that? ...

Line-breaks in Exception.Message

I'm extending Exception to implement a setter on the Message property. And this works just fine. But somehow this: CustomException.Message = "Test" + Environment.NewLine + "Test Again"; Becomes this: "Test\r\nTest Again" I've also tried this, with no luck: CustomException.Message = @"Test Test Again"; Any ideas? ...

Problem adding to Exception.Data Dictionary

I am trying to add a key value pair and having trouble adding the key to Exception.Data: The enum is of type int (default) catch (Exception ex) { ex.Data.Add(Enums.ExceptionData.SomeName, _someText); } note: when I add a watch for Enums.ExceptionData.SomeName, I get SomeName, the name of the enum b...

Programatically Add Exception to windows vista firewall .

Hi Can you please tell me, is there any way to programatically add an .exe file to the exception list for the Windows Vista firewall to allow it to run normally? I'm using VC++. ...

Best practices of Exception handling in ASP.NET web applications

We are working on exception handling with ASP.NET web applications (with C# language). Would you please let me know the best practices of Exception handling? ...

Catching specific vs. generic exceptions in c#

This question comes from a code analysis run against an object I've created. The analysis says that I should catch a more specific exception type than just the basic Exception. Do you find yourself using just catching the generic Exception or attempting to catch a specific Exception and defaulting to a generic Exception using multiple c...

best c# open source tool for handling exceptions.

Can someone point me to a list of open source projects dedicated to exceptions handling ? Or to the best tool among them ? Update: I would like to use it with a n tier winform application. I would like to catch once and for all the 3 or 4 kind of exceptions that occur in my data access stack. Then pass them to the gui stack and show th...

How can I tell if I'm in a Delphi exception stack?

From within a finally block, is it possible to tell an exception has been raised? ...

Which type exception checking required in linq inside try/catch block while performing CRUD OPERATION

Which type exception checking required in linq inside try/catch block while performing CRUD(create,read,update,delete) OPERATIONS for eg: try { db.SubmitChanges(ConflictMode.ContinueOnConflict); } catch (ChangeConflictException e) { foreach (ObjectChangeConflict occ in db.ChangeConflicts) { // All database values overwr...

Which exception should be thrown for an invalid file name?

I have a method which accepts a filename as a parameter, all filenames should end with '.csv'. Which exception should I throw if a filename that does not end with .csv is passed? Or should I take a different approach? ...

ASP.NET – Error throwing or logging

We are building an ASP.NET application in C# We have 3 layers: UI, Business and Database. We need clarification on error handling/logging. We have a error logging framework to log errors. My question is: do we need to log errors in each layer or only in the main calling layer (UI layer) by throwing the errors to UI layer from busines...

Open source server application for exception handling?

Is there some open source alternative to Hoptoad and Exceptioneer? We would like to host the exception "aggregation" application at our site. We receive tens of .NET exceptions from users in the field each day. Thus we need a way to organize them, find duplicates and prioritize fixing the exceptions that happen most often. Hoptoad is ni...