exception

Entity Framework: insert with identity column fails "sometimes" with OptimisticConcurrencyException

Hi all, While developing & learning with Entity Framework, I'm having a curious problem with inserts when I run the tests for one entity in my model. In concrete, the problem is when running some tests together. I'll explain myself: I have one entity in my model called "DtoCategoria", with 2 members: id:Int32 and name:string, mapped to...

First chance exception - long at memory location?

What is this and how can I handle/fix it? First-chance exception at 0x756fb727 in Program.exe: Microsoft C++ exception: long at memory location 0x0018f7a4. I am getting about a thousand of these each time I run my application. How can I track this down and fix it/ ...

raise MysqlError; raise Mysql::Error both work, how did this happen?

Greetings, I was working on mysql exceptions and I came across this interesting issue, in which a raised exception is responding to two different exception names. How did this happen? -daniel #!/usr/bin/env ruby require 'rubygems' require 'mysql' require 'yaml' require 'pp' $config = YAML.load_file 'database.yml' class ExceptionPr...

Throwing an exception from within a signal handler

We have a library that deals with many aspects of error reporting. I have been tasked to port this library to Linux. When running though my little test suite, one of the tests failed. A simplified version of the test appears below. /* Compiler: 4.1.1 20070105 RedHat 4.1.1-52 Output terminate called after th...

save Exceptions to file in python

Hello, I want to save all following Exceptions in a file. The reason why I need this is because the IDLE for python 3.1.1 in Ubuntu raises an Exception at calltipps, but close to fast, that it isn't readble. Also I need this for testing. The best, would be if I just call a function which saves all Exception to a file. Thank you! ;) // e...

Why does stack get truncated in Exception.StackTrace?

Why does the high part of the stack (in Exception.StackTrace) gets truncated? Let's see a simple example: public void ExternalMethod() { InternalMethod(); } public void InternalMethod() { try { throw new Exception(); } catch(Exception ex) { // ex.StackTrace here doesn't contain ExternalMethod()! } } It seems l...

Throwing exceptions in callback method for Timers

I was unable to find an answer to this question anywhere... What happens with the exceptions thrown in the callback method for System.Threading.Timer, (or in the event handler for System.Timers.Timer). Is the exception propagated to the thread on which the timer was created or is the exception lost? What are the side-effects of throwin...

Value Doesn't Fall Within The Expected

Hello, I'm building a application that uses a file to configure some fonts. It's like this: Font = Verdana Size = 12 Style = Bold And my code is like this: openDialog.ShowDialog(); string file = openDialog.FileName; StreamReader reader = new StreamReader(file); while (reader.Peek() <= 0) { string line = reader.ReadLine(); st...

Django + Postgresql -> unhandled exception.

I'm occasionally but quite often getting an unhandled exception in cursor.execute (django1.1/db/models/sql/query.py line 2369), using psycopg2 with postgresql. Looks like the database drops connection in some way, so Django crashes. For unhandled exception there is a ticket in Django's bugtrack (#11015), but I'm rather interested in re...

Error: "Exception has been thrown by the target of an invocation."

Hi all, I use VS 2008 professional, and use Unit tests. Sometimes, I get the error: Error: "Exception has been thrown by the target of an invocation." http://peitor.blogspot.com/2009/10/sometimes-it-works-sometimes-not.html What I did and didn’t help: Start up Visual Studio in safe mode (parameter /SafeMode ) Start up Visual Stud...

Database problem: how to diagnose and fix the problem?

Hi, I created an application which stores values into the database and retrieves the stored data. While running an application in run mode everything seems to work fine (the values are stored and retrieved successfully) but when I run in the debug mode the process throws IllegalStateException and so far haven't found a cause. The metho...

Cross compiler exception handling - Can it be done safely?

I am doing some maintenance on a C++ windows dll library that is required to work with different VC++ compilers (as I don’t want to address different mangling schemes). I have already eliminated any use of the STL in the interface. I have insured that heap corruption will not occur from mixing different new/delete’s. The final item i...

Java: How would I write a try-catch-repeat block?

I am aware of a counter approach to do this. I was wondering if there is a nice and compact way to do this. ...

Why is exception handling bad?

I've heard this on the Internet. For instance, Google's Go language has no exceptions as a design choice, and Linus of Linux fame has called exceptions crap. I am just wondering why? ...

Redirect to error page

I want to use Response.Redirect to redirect the browser when an exception occurs. I also want to pass the exception message to my error page. For example: string URL = "Page2.aspx?Exception=" + ex.ToString() Response.Redirect(URL) Can it be done? Is this the right syntax? ...

proper way to read user input from command line in java

I was hoping to get some opinions regarding best practices and comments on the way I read user input from the command line. Is there a recommended way to do this, am I using the try/catch blocks properly? My example here works fine, but would still like to hear if there is a 'cleaner' way to do this. Many thanks. For example are he retu...

How to catch Exception and continue program? C#

I need to do a check to see if the file exists that they input, How can I do this, I tried using try & catch and it has no effect if (startarg.Contains("-del") == true) { //Searches "Uninstallers" folder for uninstaller containing the name that they type after "-del" and runs it string uninsta...

Preserving SCRIPT tags (and more) in CKEditor

Update: I'm thinking the solution to this problem is in CKEDITOR.config.protectedSource(), but my regular-expression experience is proving to be too juvenile to handle this issue. How would I go about exempting all tags that contain the 'preserved' class from being touched by CKEditor? Is it possible to create a block of code within t...

GetStackTrace in Delphi 7?

Using Delphi 7, how can I get a string representing the stack-trace from an Exception? try SomethingDodgy(); except on E:Exception do begin // print stack trace Log.Write(/* ??? */); end; end; I hear there's a GetStackTrace function in the latest delphi, but I can't find anything for delphi 7. No, upgrading is not an opt...

Why not catch general Exceptions

My VS just told me; Warning 2 CA1031 : Microsoft.Design : Modify 'Program.Main(string[])' to catch a more specific exception than 'Exception' or rethrow the exception. Why should I do that? If I do so, and don't catch all exceptions to handle them, my program crashes with the all-popular report-screen. I don't want my users to get ...