I have unmanaged C++ calling a managed delegate via the function pointer provided by Marshal::GetFunctionPointerForDelegate. This delegate has the potential to throw an exception. I need to be able to properly handle this exception in my unmanaged C++ to ensure things like pointer cleanup, and potentially rethrow the exception up into ...
In my Silverlight project I have a thread that fires every x milliseconds. In this thread I was attempting to change the state of the application. This wasn't working and I didn't know why, so put a breakpoint in to the Timer callback. The breakpoint was hit, but the minute I attempted to change the state it just bailed out of the functi...
I have some really complicated legacy code I've been working on that crashes when collecting big chunks of data. I've been unable to find the exact reason for the crashes and am trying different ways to solve it or at least recover nicely. The last thing I did was enclose the crashing code in a
try
...
except
cleanup();
end;
just ...
I can hookup to AppDomain.CurrentDomain.UnhandledException to log exceptions from background threads, but how do I prevent them terminating the runtime?
...
I'm trying to catch a ClassCastException when deserializing an object from xml.
So,
try {
restoredItem = (T) decoder.readObject();
} catch (ClassCastException e){
//don't need to crash at this point,
//just let the user know that a wrong file has been passed.
}
And yet this won't as the exception do...
I have a method running in a seperate thread. The thread is created and started from a form in a windows application. If an exception is thrown from inside the thread, what is the best way to pass it back to the main application. Right now, I'm passing a reference to the main form into the thread, then invoking the method from the thr...
Hi, I'm actually developing a Web Service in Java using Axis 2.
I designed my service as a POJO (Plain Old Java Object) with public method throwing exceptions :
public class MyService {
public Object myMethod() throws MyException {
[...]
}
}
I then generated the WSDL using Axis2 ant task. With the WSDL I generate a clien...
Using something like this:
try:
#Something...
except BaseException, excep:
logger = logging.getLogger("componet")
logger.warning("something raised an exception: " + excep)
logger.info("something raised an exception: " + excep)
I would rather not have it on the error-level cause in my special case it is not an error. At ...
Why is an exception being thrown in the "f++" part of the code below ("IndexOutOfRangeException was unhandled by user code"):
for (int f = 0; f < gnf; f++)
{
fieldNames[g] = grid.FieldName(f);
}
The bug is in the "fieldNames[g] = ..." part of the code, my algorithm should be:
for (int f = 0; f < gnf; f++)
{
fieldNam...
I might be missing something obvious but is there a reference somewhere about what exceptions are thrown by functions in .NET and why the exception might be thrown?
As an example, I was recently trying out Linq in Visual C# 2008 and I was loading an XML file into an XDocument. It was only through testing that I realised that if you try...
When are custom Exception classes most-valuable?
Are there cases when they should or should not be used? What are the benefits?
Related questions:
Performace Considerations for throwing Exceptions
Do you write exceptions for specific issues or general exceptions?
...
How do I make my application always use English when displaying win32/.net exceptions messages?
I got this message, it looks like someone used babelfish to translate it (it's Swedish):
"System.ComponentModel.Win32Exception: Programmet kunde inte starta eftersom programmets sida-vid-sidakonfiguration är felaktig."
Extremely unhelpful, a...
What is the rationale behind throwing an exeption in JPA, when something can't be found?
Added:
This behaviour was seen in EJB2, and has as far been removed from EJB3 - but... It remains when calling Query#getSingleResult() which throws a NoResultException.
Normally I would not expect it to be an exception that something could not be fo...
What are the guidelines for when to create a new exception type instead of using one of the built-in exceptions in .Net?
The problem that got me thinking is this. I have a WCF service, which is a basic input-output service. If the service is unable to create an output, because the input is invalid, I want to throw an exception, but whic...
Anyway, I'm a little confused about when to propagate an exception and when to wrap it, and the differences.
At the moment, my understanding tells me that wrapping an exception would involve taking an exception like DriveNotFound (in IO) and then wrap it with the general IOException.
But with the concept of propagating an exception, is...
In particular from this web.config:
<configuration>
<configSections>
<section name="RStrace" type="Microsoft.ReportingServices.Diagnostics.RSTraceSectionHandler,Microsoft.ReportingServices.Diagnostics" />
</configSections>
<system.diagnostics>
<switches>
<add name="DefaultTraceSwitch" value="3" />
</switches>
<...
I start a .Net server side program on my local workstation, but soon it throws a security exception. I searched the web for answers, but no quick fix was found / worked. I just want to run my program. How do I get rid of the exception? I fully trust the program, because its mine.
Edit: Oh, yes, I do run the program from a mapped folder ...
Does anyone know how to decipher a .NET Runtime Event Id 5000 error? I have run that's logged as:
P1: <assembly name>,exe
P2: 2.1.4.1 (assembly version)
P3: 48b2b154
P4: System
P5: 2.0.0.0
P6: 471ebf0d
P7: 575
P8: 1d
P9: n3ctrye2kn3c34sgl4zqyrbfte4m13nb
P10: NIL
I assume those are either the register values of the CLR VM, or ...
The title may not really explain what I'm really trying to get at, couldn't really think of a way to describe what I mean.
I was wondering if it is good practice to check the arguments that a function accepts for nulls or empty before using them. I have this function which just wraps some hash creation like so.
Public Shared Function G...
Why am I getting an out of memory exception?
So this dies in C# on the first time through:
splitBitmaps.Add(neededImage.Clone(rectDimensions, neededImage.PixelFormat));
Where splitBitmaps is a List<BitMap> BUT this works in VB for at least 4 iterations:
arlSplitBitmaps.Add(Image.Clone(rectDimensions, Image.PixelFormat))
Where arlSp...