Unhandled Exception with Google Cloud Vision API and Xamarin - c#

I am working on Xamarin Forms to create a native application. I am new to Xamarin and as well as google cloud vision API. I am trying to create ImageAnnotatorClient object (client) by passing it channel as parameter to the Create() method. However, it doesn't create the client and gives this exception.
Exception:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Microsoft.Extensions.PlatformAbstractions.PlatformServices' threw an exception.
Code:
So, could be a problem of passing the JSON file incorrectly? I am not sure if I am doing it correctly. If it is not that could any please help me figure out how to resolve this exception?
Any help will be highly appreciated.
Thanks,
Ghalib

Related

Issue with getting Access token using forge DA

I am trying to get an access token using Forge DA using the code below. But it throws the following exception:
An exception of type 'Autodesk.Forge.Client.ApiException' occurred in mscorlib.dll but was not handled in user code. Additional information: Error calling Authenticate: The underlying connection was closed: An unexpected error occurred on a send.
Here is my code:
TwoLeggedApi oAuth = new TwoLeggedApi();
dynamic token = await oAuth.AuthenticateAsync(
txtClientId.Text,
txtClientSecret.Text,
oAuthConstants.CLIENT_CREDENTIALS ,
new Scope[] { Scope.BucketRead, Scope.BucketCreate, Scope.DataRead, Scope.DataWrite });
Since the error is calling out connection make sure your system can reach our service from your network (check proxy, firewall etc, can you reach our other endpoints?) and it supports TLS 1.2 - see here
I recommend that you use the Design Automation SDK here. This one allows you to access the new V3 API while the one I presume you are using can only access the now deprecated V2 API.
Here's a sample that uses this SDK.

The remote server returned an error: (502) Bad Gateway. in MVC

I'm creating a shopify app using ASP.NET MVC, I made some code changes.
When I tried to run the application, I got the following error message
Error: The remote server returned an error: (502) Bad Gateway.
I always make backups for my application, because I got the error message, I decided to replace it with my backup file. But the same error still occurs.
I am a beginner both in the shopify app as well as C#. Can anyone explain why this happened and how to solve it?
You are trying to access an invalid connectionString shopUrl. Check this
İt is a proxy problem. Change current proxy to default proxy :
httpRequest.Proxy = GlobalProxySelection.GetEmptyWebProxy();

Exceptions and Error 404 when using StatsManager

Okay I tried to play a little bit with the StatsManager but I always got an exception trying to use anything with it when comes to
Set a stat
Get a stat
Because I doubted myself I had the idea just to use the UWPIntegration sample that is on Github . I also added the Leaderboard items to my own project so the code works with my test sandbox. Logging in works as it should just StatsManager causes the issues.
But as with my own code I just get the same error / exception which is the following. I assume there is a bug in the code provided or the service configuration is not working as intended.
System.AggregateException occurred HResult=0x80131500 Message=One or more errors occurred. Source= StackTrace: at
System.Threading.Tasks.Task1.GetResultCore(Boolean
waitCompletionNotification) at
Microsoft.Xbox.Services.XboxLiveHttpRequest.<>c__DisplayClass35_0.<GetResponseWithAuth>b__1(Task1
getResponseTask) in
D:\Data\VisualStudio\Projects\xbox-live-api-csharp\Source\api\XboxLiveHttpRequest.cs:line
117 at System.Threading.Tasks.Task.Execute()
Inner Exception 1: AggregateException: One or more errors occurred.
Inner Exception 2: WebException: The remote server returned an error:
(404) Not Found.
Issue was found. My service.config used a wrong parameter name, see below in the comments of the solution.
There are a few different reasons why this might be the case. Not surprisingly, it means the cloud can't find the stat you've requested.
If you use Fiddler, you can capture the call and share with me the correlationID header. If you don't know Fiddler, let me know and I can help you.
However, some ideas off the top of my head
Make sure that you're in development mode - your sandbox is the one from the dev center site. If you aren't sure, you can use the Windows Device Portal to see what your sandbox is - just click on Xbox Live in the left hand navigation.
Make sure you have hit "Test" on the dev center page where you defined your featured stats and leaderboards.
Make sure you are requesting the stat by the ID name you specified in the config window, not the display name.

Unable to resolve service for type 'ClassLibrary.ApplicationDbContext' - an unhandled exception occurred

I have added a Class Library to my solution so that I can use Work Authentication on my ASP.Net Core site. I have been able to add a migration and update database from the PM console. However I am unable to use dotnet -ef. Upon running the site I am greeted with an unhandled exception occurred error and when researching the issue there is very little to be found, in order to solve it.
Any advice in order to remedy the situation would be much appreciated, I am happy to give extra detail, as I'm not sure whether the detail that I have give is sufficient.

Error Connecting to Third Party App via COM: mscorlib Exception from HRESULT: 0x80040202

One particular user is getting an exception when connecting an application I created to a third party app using COM. The connection fails with the following error:
Source: mscorlib
Message: Exception from HRESULT: 0x80040202
This software works fine for other users.
Any ideas what could be going on?
The error occurs just before the app adds some event handlers to some of the COM objects from the third party app. It is able to successfully instantiate the objects, though.
The error code for that HRESULT is CONNECT_E_CANNOTCONNECT. This is typically returned as a failure code from IConnectionPoint::Advise because the connection point doesn't support the underlying interface.
Can you give us some more context into the code that's causing this exception? Are you creating the component, using it, etc ...

Categories

Resources