63 questions
1
vote
2
answers
149
views
AggregateException is not caught
I have a problem with AggregateException thrown from .NET library. For some reason it is not caught in try-catch block. It causes whole application to crash and there are no methods from my code in ...
0
votes
2
answers
164
views
System.AggregateException in worker .NET 8 project
I am trying to implement a windows service by using worker project with communication to a SQL Server database.
ON running it, I am getting two exceptions :
System.AggregateException: Some services ...
2
votes
1
answer
195
views
.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 ...
1
vote
1
answer
935
views
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 ...
0
votes
1
answer
1k
views
How to List<> of exceptions from ArgumentException and throw a AggregateException
private void AccountValidations(CreateAccountPayload payload) {
if (string.IsNullOrEmpty(payload.Note)) {
throw new ArgumentException($ "Note cannot be empty");
}
if (string....
0
votes
1
answer
196
views
OutOfMemoryException combined with another exception
I am looking into a memory problem and found this is the log today:
System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Exception of type 'System....
2
votes
1
answer
1k
views
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:
...
0
votes
0
answers
533
views
Aggregate Exception not caught in xunit test cases
I'm querying a third-party SDK with a fully async-await method and SDK returns an AggregateException in a normal scenario. In AggregateException inner exception will be a type of ABCException.
But ...
1
vote
0
answers
73
views
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....
0
votes
1
answer
315
views
c# wpf How to catch FirestoreChangeListener exceptions
I am creating several FirestoreChangeListeners (following the User Guide at https://googleapis.github.io/google-cloud-dotnet/docs/Google.Cloud.Firestore/userguide.html) and everything is working fine, ...
3
votes
1
answer
1k
views
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 ...
0
votes
0
answers
149
views
Aggregating Event Exceptions
I'm following on with a tutorial detailing handling events thrown in multiple subscribers to an event. However when the code is run, the TargetInvocationException catch block isn't catching the ...
0
votes
2
answers
272
views
Why is TcpClient.Connect() throwing System.AggregateException
I am trying to check the TCP connection to a localhost TCP server using following code:
string host = "localhost";
int port = 61616;
using (TcpClient tcpClient = new TcpClient())
{
try
...
1
vote
1
answer
399
views
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 ...
4
votes
1
answer
1k
views
C# AggregateException, in what scenario would I have aggregated exceptions?
I am probably missing a very obvious fact, but I have a hard time understanding the need for AggregatedExceptions.
I know since async/await we don't have to bother with AggregatedExceptions anymore (...
1
vote
2
answers
6k
views
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 ...
0
votes
0
answers
73
views
Async seems to be running the tasks to completion before getting to the Await tag
I'm working on a backup manager for some Quest (critical infrastructure monitoring devices) when running the Code it seems to be running my tasks as its adding them to a task list before calling ....
1
vote
3
answers
2k
views
How to return AggregateException from async method
I got an async method working like an enhanced Task.WhenAll. It takes a bunch of tasks and returns when all are completed.
public async Task MyWhenAll(Task[] tasks) {
...
await Something();
...
0
votes
1
answer
2k
views
HttpClient PostAsync method throw Aggregate Exception
I would like to use the http client class to call an api controller method and the PostAsync method has thrown an Aggregate Exception. I tried to write an async method what call the PostAsync and try ...
0
votes
0
answers
2k
views
Falling into exception "One or more errors occurred." Aggregate Exception
I am using parallel.foreach in my code to submit multiple url for my application. Initially it work fine but after few day I noticed this exception occurs often. I googled it for many hours but no ...
3
votes
1
answer
2k
views
System.AggregateException on Task.WaitAll
I have the following code which is firing off a number of async Task.
List<TimeoutException> TimeoutExceptions = new List<TimeoutException>();
List<...
1
vote
2
answers
646
views
C++ approach to handling a collection of multiple exceptions?
In C++17, what is the proper pattern/approach to handling a collection of multiple exceptions?
Is there a C++ equivalent to C# AggregateException Class?
(I'm aware that exception as flow control is ...
3
votes
0
answers
161
views
Why does catching AggregateException cause CA2000 dispose warning?
The code below causes a code analysis warning CA2000, claiming that I need to dispose of getRequest along all code paths before it goes out of scope.
Tweaking the code slightly, for example removing ...
1
vote
1
answer
2k
views
Parallel.Foreach loop, inconsistent behavior with explicit throw statement
Created a simple program using Linqpad, where I am throwing an exception explicitly in the Parallel Foreach loop, which ideally shall be caught in the caller as Aggregate Exception, but when I ...
2
votes
1
answer
3k
views
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 ...
1
vote
1
answer
409
views
AggregateException Not Thrown in Task.Run()
I am trying to catch an AggregateException from a Task.Run() operation which intentionally fails, however an AggregateException is not thrown. Why?
public void EnterWaitingRoom(string val)
{
try
...
1
vote
1
answer
1k
views
Cancel Task and set status to "Cancelled"
I want a task to finish when the 50 Milliseconds are over. The status of the task should then be set to "Cancelled", otherwise to "RunToCompletion".
The task creation is here:
...
3
votes
2
answers
1k
views
AggregateException not caught by Task.Wait()
I'm trying to catch an NullReferenceException which is going to be thrown by Task.Factory.StartNew method. I think it should be caught by 'try' statement with task.Wait() method.
I also referred to ...
1
vote
1
answer
235
views
AggregateException during debugging forces restart of ForAll body [duplicate]
I'm experiencing really strange behavior, which I cannot neither understand nor explain. I was able to create a really simple sample to demonstrate that. That was reproduced on VS.Net 2013 & 2015 ...
1
vote
2
answers
8k
views
C# Task.WaitAll() Cancelation with Error handling
I have a problem.
I try to run multiple long running tasks. If one fails I wanna cancel all other tasks and get the failure exception.
The example given below.
I wanna catch AggregateException with ...
2
votes
1
answer
2k
views
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 ...
2
votes
0
answers
264
views
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()...
0
votes
1
answer
32
views
Cannot use "foreach" to go through exceptions because Exception does not contain 'GetEnumerator'
I want to report about Exceptions that are thrown during execution of some tasks:
//waiting for all the tasks to complete
try
{
Task.WaitAll(task1, task2, task3);
}
catch (AggregateException ex)
{...
1
vote
1
answer
237
views
Strange try/catch block behavior
I am working with Github API via Octokit.net. Now I am writing code that responsible for TwoFactorAuth. When I send request for token, if it is 2FA account, than I must get "TwoFactorRequiredException"...
-1
votes
1
answer
869
views
GetAsync gives AggregateException
HttpResponseMessage response =
client.GetAsync("api/MOB_Vw_UsersAPI/GetMOB_Vw_Users?Uname=" +
uname + "&Pass=" + pass).Result;
When I run this part of code on Windows Phone emulator ...
0
votes
0
answers
388
views
c# , parrallel.foreach can't handle AggregateException with files and complete loop
I got the problem in my pet-project. Totally I wanna counting the files in some directory filtering them by some options (length). It works good for me when "reading" of files or directories occured ...
0
votes
0
answers
45
views
Send Consecutive Posts
I am wanting to sequentially send POST() data to a website. I want post1 to finish, then begin post2, then begin post3 etc etc. I have syntax that compiles, but I get an error of that I am unsure ...
-3
votes
1
answer
14k
views
Unhandled Aggregate Exception
I have followed the tutorial in ( http://www.c-sharpcorner.com/UploadFile/a6fd36/understand-self-host-of-a-web-apiC-Sharp/ ) and ( http://www.c-sharpcorner.com/uploadfile/a6fd36/understanding-how-to-...
7
votes
1
answer
2k
views
Wrapped AggregateException reports just first exception in ToString method
I get complete set of nested exceptions when I use ToString() method on AggregateException directly:
public void GreenTest()
{
var ex = new AggregateException(new Exception("ex1"), new Exception("...
3
votes
0
answers
378
views
Unity3d, Parse.com throw exception, (System.AggregateException)
so i'm trying to use parse.com in my unity project, it was all working fine until i added a new column in my user database. It throw exception every time i tried to access my currentUser.
In the ...
0
votes
0
answers
634
views
AggregateException on Cluster.OpenBucket method in Couchbase
I am trying out Couchbase database, I've followed the tutorial here:
http://developer.couchbase.com/documentation/server/4.0/sdks/dotnet-2.2/hello-couchbase.html
I've installed the nugget from ...
3
votes
1
answer
679
views
PLINQ exception
I am using PLINQ with code below:
static void Main(string[] args)
{
var lt = new List<int>() {1,2,3,4,5};
try
{
var nlt = lt.AsParallel().Select(Test)....
1
vote
1
answer
3k
views
Why isn't my try/catch block catching System.AggregateException?
I have some code that makes an asynchronous http call like so:
try
{
var myHttpClient = new HttpClient();
var uri = "http://myendpoint.com";
HttpResponseMessage response = client.GetAsync(uri)....
2
votes
1
answer
2k
views
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 ...
9
votes
1
answer
12k
views
C# InnerException in AggregateException
I have this code as below to capture the exceptions throw from tasks created by using TaskFactory and Task.Run. If I use the TaskFactory, I am able to check the Exception thrown from the previous task ...
3
votes
2
answers
2k
views
Many nested AggregateExceptions
Working with Entity Framework 7, I made a simple mistake with some linq (used Skip and forgot to include my OrderBy clause).
The exception that was thrown by this included a number of nested ...
4
votes
1
answer
2k
views
AggregateException.Flatten() loses stack trace information. Is the lost info important or not?
The documentation on MSDN for the AggregateException.Flatten method says the following: "If any inner exceptions are themselves instances of AggregateException, this method will recursively flatten ...
1
vote
0
answers
2k
views
Json deserialize error AggregateException c#
I am getting an error trying to move a DataSourceResult from one web service to another... the client calls web service A which resides on our web server. We then make a call to web service B which ...
1
vote
2
answers
3k
views
HttpClient async methods, aggregate exceptions
HttpClient async methods (e.g. PostAsync, GetAsync etc.), if an exception is thrown, returns an AggregateException. Now an aggregate exception can contain a list of inner exceptions. My question is ...
4
votes
1
answer
2k
views
Mark task exception as handled
How can I mark an exception thrown in a task as handled. The problem is when I call the Wait() method of a task, it will throw an AggregateException even when I have already handled the ...