I'm building a tool where as exceptions propagate upwards, new data about the context of the exception gets added to the exception. The issue is, by the time the exception gets to the top level, all of the extra context data is there, but only the very latest stack trace is shown. Is there an easy way to have an exception show the origin...
The situation is as follows: Thread A catches an exception, saves the exception's data somewhere in memory (using GetExceptionInformation in the exception filter), and afterwords Thread B gets that exception information and wants to rethrow it. But the thing is, when thread B rethrows the caught exception, i'm missing the original call s...
Hello All,
Good day.
I'm new to C# and trying to call functions from a DLL (C++ ObjGen). I'm getting this message and can't figure out why. Here's the code:
object[] objID = new object[] { ID };
ObjGen.Invoke(InvokeEnum.Query_State, objID);
Dll code
///////////////////////
INVOKE_FUNC_IMPLEMENT(Query_State, CUtil::GetState)
...
I have read that there is some overhead to using C++ exceptions for exception handling as opposed to, say, checking return values. I'm only talking about overhead that is incurred when no exception is thrown. I'm also assuming that you would need to implement the code that actually checks the return value and does the appropriate thing, ...
My questions are more of historical nature than practical:
Who invented it?
Which language used it first (and to what extent)?
What was the original idea, the underlying concept (which actual problems had to be solved these days, papers welcome) ?
Is LISPs condition system the ancestor of current exception handling?
...
Given this code:
public class TwoThreads {
static Thread laurel, hardy;
public static void main(String[] args) {
laurel = new Thread() {
public void run() {
System.out.println("A");
try {
hardy.sleep(1000);
} catch (Exception e) {
...
Hi,
I have downloaded latest POI 3.5 and tried to run sample application for creation of excel sheet.But it is always giving error while exceuting some code like:
enter code here
Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook();
Generated Exception all the time is:
Exception in thread "main" java.lang.NoClassDefFoundEr...
This one has been puzzling my for some time now.
Let's imagine a class which represents a resource, and in order to be able to use this resource one needs to first call the 'Open' method on it, or an InvalidOperationException will be thrown.
Should my code also check whether someone tries to open an already open resource, or close an a...
Hello,
why the next example throws a System.ArrayTypeMismatchException?
New Int16(){4,5,6}.Cast(of UInt16).ToArray()
I expected that this line returned a UInt16 array containing 4,5 and 6.
Thanks in advance.
...
Using C#, XmlDocument.Load is throwing this exception: "hexadecimal value 0x3C, is an invalid attribute character".
What's confusing me is it works find in development. What differences should I be looking for on the remote server vs my development environment?
...
Hello,
I am actually working on a Framework development, which means require a really strong coding methodology.
I am facing a problem where I do not know which System.Exception derivated class I need to throw. Basically the case is when I have a class with fields that can be optionnaly initialized by the constructor and that have meth...
I have the following try-catch statement and I do not want to not throw the exception if the message property contains 'My error' in the text.
How can I programmatcially accomplish this? Also, would this be considered code-smell?
try
{
}
catch(Exception e)
{
if(e.Messages.Contains("My error"))
{
//want to display a frie...
Consider a scenario where a console application asks for a series of inputs, one after the other. Each input is validated before proceeding to the next. Now if an input made by the user is invalid, an error message is shown and the user is asked if he/she wants to continue. If the user chooses no, the input process is aborted. If the use...
int check_row;
for (n=0; n<9; n++) {
used_numbers[n] = n+1;
}
for (row=0; row<3; row++) {
for (check_row=0; check_row<3; check_row++) {
used_numbers[(sudoku[row][check_row]-1)] = 0;
}
...
int sudoku[9][9] declared as global variable and used_numbers[9] as int.
In sudoku matrix for row from 0 to 2 and col from 0 to ...
Does anybody know if it's possible to write the code in the catch block below as a single statement? I haven't been able to come up with a way, and was just curious if there was one.
IMPORTANT: the stack trace must be preserved.
catch (Exception e)
{
if (e is MyCustomException)
{
// throw original e...
I'm using JDBC in sync with MySQL to add and define rows to a MySQL database's Table. The problem is that I don't know why it is throwing an Exception when I use methods from the ResultSet class to add rows to the table. Bear in mind that I've earlier tried just reading the table via ResultSet methods, and, it successfully printed out th...
I have been doing a bit of experimenting, and have discovered that an exception is being thrown, when an integer divide by zero occurs.
#include <iostream>
#include <stdexcept>
using namespace std;
int main
(
void
)
{
try
{
int x = 3;
int y = 0;
int z = x / y;
cout << "Didn't throw or s...
I'm using the Microsoft.Data.Entity.CTP (in the Entity Framework CTP) under the .NET 4 framework to create the EDMX metadata from my C# classes to create a database schema.
I setup a simple model as such:
public class AModelContainer : ObjectContext
{
public IObjectSet<RegularClass> RegularClasses {
get { return CreateObje...
When an unexpected exception occurs in your program (in the debugger). Sometimes you just want to skip it since killing the program at that point is more harmful than continuing. Or you just want to continue since you were more interested in another error/bug
Is there an option/compilerflag/secretswitch to enable this?
I understand exc...
Hi,
I'm using JEDI WSCL to change permissions on a folder during installation.
When compiling without Optimization, and with Range Checking, I get a rangecheck when setting the new Access Control List.
procedure SetFilePermissions(const folder: string);
var
FileObject: TJwSecureFileObject;
DACL: TJwDAccessControlList;
begin
File...