exception

Problem integrating WCF with Sharp architecture

I'm working with an application which uses wcf and sharp architecture, I'm trying to create a service to write to the database. Here is my service: [ServiceContract] public interface IFacilitiesWcfService : ICloseableAndAbortable { [OperationContract] void AddFacility(string facility); } [AspNetCompatibilityRequirements(Requir...

Problem with cross casting in Visual Studio 2003

I am using Visual Studio 2003 to compile and run following program. There are 4 assignment operation where I expect 2 of them to run ok and 2 of them to raise exception. There is a dynamic casting inside overloaded = operator which expect to fail during non proper cross casting (Casting from Apple to Orange or Orange to Apple). But in m...

Refactoring exceptions for workflow

I am currently refactoring an application which uses exceptions for logic flow. The code is difficult to read and maintain and makes a S.O.L.I.D fanboy like myself cry when reading it (not to mention the longest catch block I've ever seen in my career). My question is what pattern(s) could you use to make it easier to maintain or how w...

How can catched exception be null (not NullReferenceException)?

Hey I have run into a rather weird little problem. In the following code I can not understand how e can be null; try { //Some Code here } catch (Exception e) { //Here e is null } As far as I know, throw null will be converted to throw new NullReferenceException(). The problem seems to be related to multithreading, as removi...

NullReferenceException mystery

...

C# API Development Exception handling

Is there a best-practice or industry standard for throwing exceptions from a toolkit API? Should the user facing methods catch and wrap up Exception in some sort of CustomException so that users only have to worry about CustomExceptions coming out of the API? Or is the convention to just let those bubble up? We're concerned with being...

Get the method parameters from the throwing method in C#

I have a nasty exception that seems to occure deep inside the DataGridView Code. I have a class that inherits from BindingList which is the DataSource of a BindingSource which is the DataSoure of a DataGridView. Under some strange circumstances I get an exception during the overridden OnListChanged() method of my class: protected ...

S#harp architecture mapping many to many and ado.net data services: A single resource was expected for the result, but multiple resources were found.

Hi, I'm developing an application that reads data from a SQL server database (migrated from a legacy DB) with nHibernate and s#arp architecture through ADO.NET Data services. I'm trying to map a many-to-many relationship. I have a Error class: public class Error { public virtual int ERROR_ID { get; set; } public virtual string E...

Named pipe not found when using WCF netNamedPipeBinding

I am the developer of a WCF service. My test clients work very well with it. But when it comes to real clients (using the same client proxy), it fails. The same WCF service works with netTcpBinding, this error occurs only with netNamedPipeBinding, even with ConcurrencyMode = ConcurrencyMode.Single Here is the exception There was no ...

Exceptions and Linq to Entities

I have a tough question to ask so please bier with me. In this code below, this works because the programmer was interested in projecting only the specific errors caused by the physical data-layer to the eventlog. The rest are pushed farther up the stack. This is specifically because he is able to catch OdbcException(s). I am impleme...

C++ - Arguments for Exceptions over Return Codes

I'm having a discussion about which way to go in a new C++ project. I favor exceptions over return codes (for exceptional cases only) for the following reasons - Constructors can't give a return code Decouples the failure path (which should be very rare) from the logical code which is cleaner Faster in the non-exceptional case (no che...

C++: Core Dump Exception

I've successfully compiled this code, but when I get around to the last for loop in the main, I get a core dump handle_exception. How do I fix this? main.cpp #include <iostream> #include <string> #include <fstream> #include <vector> #include "DRSequence.h" using namespace std; vector <DRSequence> array; int indexOfSequenceWithFirstWo...

Is Google's "Go" language multi-value return statement an alternative to exceptions?

It seems to me Google's alternatives to exceptions are GO: multi-value return "return val, err;" GO, C++: nil checks (early return) GO, C++: "handle the damn error" (my term) C++: assert(expression) Is multi-value return useful enough to act as an alternative? Why are "asserts" considered alternatives? Does Google think it O.K. if a...

Quartz API error.

When I compile and run my application on my local machine with specs Windows XP sp2, JDK 5u11, I get no error. But when I try to run this application (compiled on Windows XP) on a Linux Debian distro, JDK 5 I get the following error: Unable to instantiate class load helper class: null What can I do to get rid of this exception message...

Disable Exceptions in BOOST?

I want to use boost::asio but I don't want boost to throw exceptions, because in my environment exceptions must not be raised. I've encountered BOOST_NO_EXCEPTIONS but the documentation says that callers of throw_exception can assume that this function never returns. But how can a user supplied function not return? What replacement fun...

Avoid slicing of exception types (C++)

I am designing an exception hierarchy in C++ for my library. The "hierarchy" is 4 classes derived from std::runtime_error. I would like to avoid the slicing problem for the exception classes so made the copy constructors protected. But apparently gcc requires to call the copy constructor when throwing instances of them, so complains abou...

SyntaxError inconsistency in Python?

Consider these two snippets: try: a+a=a except SyntaxError: print "first exception caught" . try: eval("a+a=a") except SyntaxError: print "second exception caught" In the second case the "second exception .." statement is printed (exception caught), while in the first one isn't. Is first exception (lets call it "S...

Why do some .Net Exceptions end with newline

I have a ListView that displays error to the user. Part of it also includes the exception message. The error is also written to a log file. Now I have noticed that some exception messages end with a newline. e.g. File.Move can return the message (English .Net 3.5 SP1) "Cannot create a file when that file already exists.\r\n". The newli...

Exception handling

I heard people say exception handling is a bit expensive because of the stack unwinding. I don't get something, the stack unwinding happens whether I throw an exception and whether I use "return". So where is the difference? If for example I get a memory problem that I can't handle - the only option is to stop the function till the I r...

Tomcat: Handle Servlet Exception

I am setting up PHP on my Tomcatserver using the PECL-servlet (PHP/PECL-version 5.2.5). The server now sucessfully handles real PHP-files, but i am having a problem with requests for nonexistent pages. A request for such a page, f.ex: http://www.mydomain.com/nonexistentfile.php, causes the servlet to raise a java.io.IOException, which i...