Questions tagged [aggregateexception]
61 questions
2
votes
0 answers
How to fix a System.AggregateException when using Parallel.For loops in C#
I have a loop in C# that looks like this:
for (int level = 0; level < numLevels; level++){
for (int y = 0; y < ysize; y++){
for (int x = 0; x < xsize; x++){
outArray[y*xsize + x] = SomeMathWasDone(level);
}
}
}
I…

mmr
- 14,781
- 29
- 95
- 145
2
votes
1 answer
Why is my custom exception wrapped by an AggregatException. What does this depend on?
I have the following custom exception :
public class MyCustomException : Exception
{
public MyCustomException(string message) : base(message)
{ }
}
I throw it at this point:
private async Task AquireToken()
…

DaveVentura
- 612
- 5
- 19
2
votes
1 answer
System.AggregateException on Task.WaitAll
I have the following code which is firing off a number of async Task.
List TimeoutExceptions = new List();
List TaskCanceledExceptions = new List();
…

neildt
- 5,101
- 10
- 56
- 107
2
votes
1 answer
Rethrowing inner exception of an AggregateException
Let's say I have an Interface:
interface A {
string Do();
}
and then I implement this interface in a class. The implementation requires some async operations. Something like the following:
class B : A {
public string Do() {
return…

alfoks
- 4,324
- 4
- 29
- 44
2
votes
1 answer
C# - Xamarin - HttpClient - Operation is not valid due to the current state of the object - iOS
I'm working on a cross platform library that makes HTTP requests. It's working fine on Android, but when I try to use it on iOS I'm getting an exception and I can't figure out how to fix it.
Here is my code:
// method from cross platform…

Jared Price
- 5,217
- 7
- 44
- 74
2
votes
0 answers
SignalR exception kills the service/app - System.Threading.Tasks.TaskExceptionHolder.Finalize()
I've been battling this issue for sometimes. A windows service targeting .NET 4.0 creates a .NET signalr client but gets killed after sometimes for System.Threading.Tasks.TaskExceptionHolder.Finalize() due to aggregate exception thrown within the…

Stack Undefined
- 1,050
- 1
- 14
- 23
2
votes
1 answer
Keep UI responsive using Tasks, Handle AggregateException
I have a problem with handling the AggregateException if my WinForms application starts a task to keep responsive while the task is performing.
The simplified case is as follows.
Suppose my Form has a fairly slow method, for instance:
private…

Harald Coppoolse
- 28,834
- 7
- 67
- 116
2
votes
2 answers
Task.WaitAll Index Out Of Bounds Exception Cause
Why does this not every complete? Instead it throws an exception, like the exception wasn't caught. Moreover, the exceptions "Index out of bounds of array" doesn't make sense to me.
int n = 3;
string[] names = new string[] { "sally",…

RexCardan
- 398
- 2
- 7
2
votes
0 answers
WindowsPhone PhoneCamera - Exception at page resume
I have a strange exception. I use the PhoneCamera API in a page, that the user can make some phothos, which are directly uploaded after the capture.
My Code:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
…

Joehl
- 3,671
- 3
- 25
- 53
1
vote
1 answer
.NET Base Exception constructor is overriding my message, how do I stop it?
I have a custom exception class derived from AggregateException. It's shown below.
As you can see, one of the things I do is build a custom Message, where I truncate the inner exceptions to keep it short.
The problem is, if I catch this exception…

Bassinator
- 1,682
- 3
- 23
- 50
1
vote
1 answer
How to catch Task exception in C#
I would like to catch all Task's exceptions of a batch of task, but I don't find the best solution. Maybe anyone can help me please?
I have a function with the following declaration:
public async Task CreateBooking(CreateBookingModel…

Adrien Ruffie
- 195
- 4
- 16
1
vote
0 answers
Self-contained win-x64 executable AggregateException: Connection actively refused
I am trying to publish a self-contained executable for Windows. When I try to run the executable via a privileged powershell (or cmd) window, I get the following error:
Unhandled exception. System.AggregateException: One or more errors occurred. (No…

PikachuBoss33
- 11
- 1
1
vote
1 answer
AggregateException from Task.WhenAll only contains first exception when awaited
When causing multiple exceptions in a Task.WhenAll call, it looks like only one of the exceptions is absorbed into the Task once you await it through more than one layer of awaiting. I was under the impression that the Task.Exception.InnerExceptions…

John
- 500
- 4
- 15
1
vote
1 answer
ScrapySharp Form Submit causing System.AggregateException
I spent hours racking my head as to why this isn't working
I'm trying to use ScrapySharp to scrape websites, right now just trying out sample sites then moving to my actual site.
Every time I do a form.Submit() in my program I get hit with a…

arcanium0611
- 123
- 12
1
vote
2 answers
Proper way to handle C# AggregateException
I have a question about when its safe to handle an aggregate exception when using WhenAll(). It seems like the natural place would be inside the catch block, because if the catch block never fires, it would imply there are no exceptions to handle.…

broadbear
- 614
- 8
- 19