exception

Why doesn't a foreach loop work in certain cases?

Hello good people, I was using a foreach loop to go through a list of data to process (removing said data once processed--this was inside a lock). This method caused an ArgumentException now and then. Catching it would have been expensive so I tried tracking down the issue but I couldn't figure it out. I have since switched to a for l...

10057 WSA Exception when SendBuf via Socket

Client: //is called when the client tries to log in procedure TLogin_Form.btnLoginClick(Sender: TObject); var LoginQuery: TQuery; begin //If socket not open, open it if not LoginSocket.Active then begin LoginSocket.Open; end; //create package LoginQuery.Login := ledtName.Text; LoginQuery.Passwort := ledtPasswort...

Why Would a Dependency-Property Implementation Crash My Application When I Provide a Default Value?

Why would a dependency-property implementation crash my application when I provide a default value? This segment of code is in the class declaration for my UserControl object. Everything works fine - it compiles and runs perfectly. public static System.Windows.DependencyProperty DepProp = System.Windows.DependencyProperty.Regis...

Win32 Message Handler Error Propagation

I'm writing a (C++) application that utilizes a single dialog box. After setting up a message pump and handler I started wondering how I would go about propagating C++ exceptions to my original code (i.e., the code that calls CreateDialogParam, for instance). Here's a skeleton example of what I mean: BOOL CALLBACK DialogProc(HWND, UINT...

ASP.NET MVC with jQuery : catch exception + display error message

Hello, I have this code : $(document).ready(function() { $('.DOFFDelete').click(function() { var id = $(this).attr("id"); $.post("/Customer/DayOffDelete", { customerid: getCustomerId(), doffId: id }, function(data) { $("#myFormDOFF").html(data); }); }); }); In the Controller, I have th...

Exception while using AS in C#

While writing var e = element.NextSibling as HtmlElement; I get an invalid cast exception. I thought as prevents cast exception and returns null? because thats what i wanted/excepted. Either tell me how do i get e to be null instead of an exception? or why i got this exception when using the as keyword? -edit- Correct it was element....

Try Catch Block in Java

So I'm given this code and I have to create an Exception and then use a Try Catch Block to catch it. I've already made the Exception, at the bottom of the code. But I've never used a Try Catch Block before and am not sure how to implement it. The Exception is if a rank that isn't listed under the enum is entered. I need to use a toStri...

Java exception handling - Custom exception

I have a custom exception like this public class MyOwnException extends Exception { } Then in my class I have two methods public void ExceptionTest() throws Exception { throw new FileNotFoundException(); } public void ApplicationExceptionTest() throws MyOwnException { throw new FileNotFoundException(); } Eclipse complains a...

SubSonic 3.0.0.3 Update Exception

When I attempt to update in SubSonic I'm greeted with a Null Reference Exception. This is the exception message I get: Object reference not set to an instance of an object.","StackTrace":" at SubSonic.Query.Update.GetCommand() I've checked the object I'm updating and there are no missing fields, all the class properties match t...

exit failed script run (python)

I have seen several questions about exiting a script after a task is successfully completed, but is there a way to do the same for a script which has failed? I am writing a testing script which just checks that a camera is functioning correctly. If the first test fails it is more than likely that the following tests will also fail; there...

.NET "Send error report to [me]"

If an exception propagates all the way up to the top of my application (which, of course, will never happen), I would like to offer the option of sending an error report to me before the program crashes. What I have in mind is wrapping everything in the Main function in a try-catch, and a little class that sends the stack trace and other...

Is there something like Python's 'with' in C#?

Python has a nice keyword since 2.6 called with. Is there something similar in C#? ...

Exception calling Silverlight enabled WCF service when using other assemblies

General description I am calling a Silverlight enabled WCF service from a Silverlight application. My service queries a database (SQL Server) and returns values from there. The problem is that the service uses other libraries that do the dirty database work and I get this exception when trying to use the service: Exception System.Se...

Exception changing focus with the tab key in a .NET application

I have a very simple Windows application, with a few controls, a DataGridView and the Adobe PDF viewer control. The app works fine except when tabbing around to switch focus between controls, I regularly get the following exception. System.AccessViolationException was unhandled Message="Attempted to read or write protected memory. Thi...

Java Exception printing twice

I know the exception is kind of pointless, but I was trying to learn how to use / create exceptions so I used this. The only problem is for some reason my error message generated by my exception is printing to console twice. import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Scanner; ...

C# JSON WebClient Request throwing ex

Not really sure why I'm getting the exception.. the code is sound and the API is working through my browser. var url = new Uri("http://octopart.com/api/search?keywords=" + topic.Text); WebClient octopartCall = new WebClient(); octopartCall.OpenReadCompleted += new OpenReadCompletedEventHandler(Octopart_Completed); ...

In Python, how to tell if being called by exception handling code?

I would like to write a function in Python (2.6) that can determine if it is being called from exception handling code somewhere up the stack. This is for a specialized logging use. In python's logging module, the caller has to explicitly specify that exception information should be logged (either by calling logger.exception() or by usi...

How to determine why a task destroys , VxWorks ?

Hi I have a VxWorks application running on ARM uC. First let me summarize the application; Application consists of a 3rd party stack and a gateway application. We have implemented an operating system abstraction layer to support OS in-dependency. The underlying stack has its own memory management&control facility which holds memory ...

How to detect when an exception is in flight?

In C++ (MSVC) how can I test whether an exception is currently "in flight". Ie, code which is being called as part of a class destructor may be getting invoked because an exception is unwinding the stack.. How can I detect this case as opposed to the normal case of a destructor being called due to a normal return? ...

Locks on Files Preventing Overwriting Files in ASP.NET

I have a small C# ASP.NET web application which generates several PNG image files from dynamically created .NET Chart controls. These are then used to: Create a lightbox effect Create a PDF Create a Zip file The application gets little usage and the data is updated often, so I'm re-creating everything on each load. The problem is, ...