Basically, I've got a situation where one thread throws an exception which a different thread needs to handle. I'm trying to do this with boost exception, however somewhere along the line the exception loses its type and thus isn't caught by the catch blocks.
Basically, thread B wants to do something, however for various reasons it mus...
Duplicate: How to catch exceptions from a ThreadPool.QueueUserWorkItem?
I am queueing up multiple delegates on the .Net ThreadPool for a large number of independant remoting calls that themselves call multiple databases and other offline resources. By Queueing these calls on the ThreadPool I can run them concurrently and minimize th...
I'm writing .NET On-the-Fly compiler for CLR scripting. And have a dilemma: is it better to throw an exception on build fail or not?
So what is the best-practice point of view, which approach is more suitable?
try
{
compiler.Compile(); // do not throws an exception only if build succeed
}
catch(CompilerException ex)
{
string err = ...
(Forgive me because I do not write in Java very often.)
I'm writing a client-side network application in Java and I'm having an interesting issue. Every call to readInt() throws an EOFException. The variable is of type DataInputStream (initialized as: DataInputStream din = new DataInputStream(new BufferedInputStream(sock.getInputStream(...
I'm curious if anyone has given some thought to the wording in desktop application error messages. As a developer I always put on my programmer hat and display it in a dialect that looks like a robot is speaking to the user.
For example:
Failed to open file _
Unable to retrieve settings file
Error occurred updating the database
Cannot...
Im trying to deserialize an XML file with XmlSerializer, however im getting this exception:
"There is an error in XML document (1,
2)" The innerexception is:
"<Mymessage
xmlns='http://MyMessages/'> was not
expected."
Which is the very first line in the XML file. my guess is that it has something to do with the xmlns.
I...
I've been writing a lot of code recently that involves interop with the Win32 API and have been starting to wonder what's the best way to deal with native (unmanaged) errors that are caused by calls to Windows API functions.
Currently, the calls to native functions look something like this:
// NativeFunction returns true when successfu...
Which one is a better practice in programming?
I am not talking about complete exclusivity. It's more for things like:
list<T>.Find, where you get default(T) or your value, instead of ValueNotFound exception (example).
or
list<T>.IndexOf, where you get -1 or the correct index.
...
One of the filters on an application I'm developing checks to see if a user owns the item they are trying to alter. The action is decorated by the [RequiresOwnership] attribute, and inside the attribute logic, I check to see if the user owns the item, and if they don't, I throw an UnauthorizedAccessException.
My question is this: Where ...
I have two exe files in the same folder, I can run exe2 from a button in exe1. Today I was observing a customer over a remote (terminal services) session and exe2 failed to run 'File not found' error, yet exe1 was in the same directort when we checked. So should I be using AppDomain.CurrentDomain.BaseDirectory or System.Environment.Curre...
Hi,
Could anyone notice what could be wrong with the following function:
public string Login(string username, string password)
{
string result = "";
string select = "SELECT user_id FROM [user] WHERE username = @username AND password = @password";
SqlConnection conn = new SqlConnection(connectionString);
...
Hello,
I am capturing images from a smart camera imager and receiving the byte array from the camera through socket programming (.NET application is the client, camera is the server).
The problem is that i get System.InvalidArgument exception at runtime.
private Image byteArrayToImage(byte[] byteArray) {
if(byteArray != null) {
...
I am trying to upload a file from my Windows application to the server into a particular Folder using C#. However, I am getting an exception:
"An exception occurred during a WebClient request".
Here is my code:
for (int i = 0; i < dtResponseAttach.Rows.Count; i++)
{
string filePath = dtResponseAttach.Rows[i]["Response"];
WebC...
I am getting an error in NetBeans saying I must throw an SQLException in this method:
private void displayCustomerInfo(java.awt.event.ActionEvent evt)
{
int custID = Integer.parseInt(customerID.getText());
String info = getCustomerInfo(custID);
re...
In a current Java project we have code similar to the following example:
try {
doSomeThing(anObject);
}
catch (SameException e) {
// Do nothing or log, but don't abort current method.
}
try {
doOtherThing(anObject);
}
catch (SameException e) {
// Do nothing or log, but don't abort current method.
}
// ... some more cal...
Good evening, everyone;
My name is Braden and I'm using Visual Basic 2008 Express Edition.
I've been running through the MSDN help documents to get a hang of Visual Basic. After trying out the example using timers --one drags a label and timer component into the designer and adds the following to the components subroutine
Label1.Text...
If an invalid value is passed to a property setter and an ArgumentException-ish exception is thrown, what should be passed as paramName? "value", since it seemingly is the actual argument? Wouldn't it be more clear to pass the name of the propery instead?
...
The usual behaviour of VS is to display in yellow the faulting line :
int i = 1;
switch (i)
{
default:
throw new NotImplementedException(); //this will be yellow
}
However, quite frequently, I've witnessed that the wrong line is coloured, like in this example :
int i = 1;
switch (i)...
I have two controls containing DataGridViews on different panes in a DockPanel. If one is in edit mode and I switch pane, I get a NullReferenceException thrown from within the DataGridView's EndEdit() method. The stack trace doesn't go any deeper than that and the exception doesn't contain any more information.
I've looked at that met...
Hello
I'm developing word automation application and I'm facing serious issue with unexpected RPC/COM cast exception
[System.InvalidCastException: Nie
można rzutować obiektu modelu COM typu
'System.__ComObject' na typ interfejsu
'Microsoft.Office.Interop.Word._Application'.
Ta operacja nie powiodła się, ponieważ
wywołanie...