Azure-Samples / cognitive-services-vision-csharp-sdk-quickstarts

Latest sample code for Cognitive Services Vision C# SDK quickstarts.
MIT License
21 stars 42 forks source link

System.AggregateException #1

Closed sandrapavankumar closed 6 years ago

sandrapavankumar commented 6 years ago

I'm trying the vision api for handwritten text recognition using C# with the mentioned code in Git. I face the below error at line Task.WhenAll(t1, t2).Wait(5000); Please suggest.

System.AggregateException HResult=0x80131500 Message=One or more errors occurred. Source=mscorlib StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout) at ImageHandText.Program.Main(String[] args) in C:\Users\sandr\source\repos\HWCR\HWCR\Program.cs:line 46

Inner Exception 1: ComputerVisionErrorException: Operation returned an invalid status code 'NotFound'

easyj2j commented 6 years ago

Are you using the ComputerVision 3.2.0 NuGet package?

sandrapavankumar commented 6 years ago

Yes, I'm using Computer Vision library 3.2.0 NuGet package.

easyj2j commented 6 years ago

Are you getting any output in the command window?

sandrapavankumar commented 6 years ago

Please check the below logs.

'HandwrittenText.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\sandr\OneDrive\Desktop\VisionStart\ComputerVision\HandwrittenText\bin\Debug\HandwrittenText.exe'. Symbols loaded. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Users\sandr\OneDrive\Desktop\VisionStart\ComputerVision\HandwrittenText\bin\Debug\Microsoft.Azure.CognitiveServices.Vision.ComputerVision.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Users\sandr\OneDrive\Desktop\VisionStart\ComputerVision\HandwrittenText\bin\Debug\Microsoft.Rest.ClientRuntime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Net.Http.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http.WebRequest\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Net.Http.WebRequest.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Users\sandr\OneDrive\Desktop\VisionStart\ComputerVision\HandwrittenText\bin\Debug\Newtonsoft.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0b77a5c561934e089\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0b77a5c561934e089\System.Numerics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Exception thrown: 'Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models.ComputerVisionErrorException' in mscorlib.dll Exception thrown: 'System.AggregateException' in mscorlib.dll An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll One or more errors occurred.

'HandwrittenText.exe' (CLR v4.0.30319: HandwrittenText.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\common7\ide\PrivateAssemblies\Runtime\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The thread 0x3ce4 has exited with code 0 (0x0). The thread 0x25a4 has exited with code 0 (0x0). The program '[5004] HandwrittenText.exe' has exited with code 0 (0x0).

easyj2j commented 6 years ago

Are you getting any output written by the program?

sandrapavankumar commented 6 years ago

The output message is "Images being analyzed ... " and followed by an exception.

easyj2j commented 6 years ago

Would you attach your Program.cs file without showing your subscriptionKey?

sandrapavankumar commented 6 years ago

PFA.. program.txt

easyj2j commented 6 years ago

Leave the Endpoint as it shows in the example. The client library tacks on the service and v#.

computerVision.Endpoint = "https://westcentralus.api.cognitive.microsoft.com";

sandrapavankumar commented 6 years ago

I still face the same issue.

easyj2j commented 6 years ago

Your program works correctly when I run it. Is it possible that your subscription key is associated with a different region than westcentralus?