i am trying to get geolocation in xamarin, current location. i am following this link https://learn.microsoft.com/en-us/xamarin/essentials/geocoding?context=xamarin%2Fandroid&tabs=android . i have followed everythinMg that is shown in there but i am getting an error at var placemarks = await Geocoding.GetPlacemarksAsync(MyLocation.Latitude, yLocation.Longitude);
i am getting latitude and longitude. when i am trying to change it to address it is showing error. i have given permission of location and internet but still i am getting error.
" Timed out waiting for response from server at java.interop.
i gave permission for internet and location
private async void btnGetAddress_Clicked(object sender, EventArgs e)
{
try
{
double lat = MyLocation.Latitude;
double lon = MyLocation.Longitude;
LabelAddress.Text = "";
var placemarks = await Geocoding.GetPlacemarksAsync(MyLocation.Latitude, MyLocation.Longitude);
var placemark = placemarks?.FirstOrDefault();
if (placemark != null)
{
var geocoding =
$"AdminArea: {placemark.AdminArea}\n" +
$"CountryCode: {placemark.CountryCode}\n" +
$"CountryName: {placemark.CountryName}\n" +
$"FeatureName: {placemark.FeatureName}\n" +
$"Locality: {placemark.Locality}\n" +
$"PostalCode: {placemark.PostalCode}\n" +
$"SubAdminArea: {placemark.SubAdminArea}\n" +
$"SubLocality: {placemark.SubLocality}\n" +
$"SubThoroughfare: {placemark.SubThoroughfare}\n" +
$"Thoroughfare: {placemark.Thoroughfare}\n";
Console.WriteLine(geocoding);
LabelAddress.Text = geocoding;
}
}
catch(Exception ex)
{
LabelAddress.Text = ex.ToString();
}
}
i want to get the current location of the user
full Error :
{Java.IO.IOException: Timed out waiting for response from server
at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <034d4a9852dd45bea9353cc7776c99f0>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in <034d4a9852dd45bea9353cc7776c99f0>:0
at Android.Locations.Geocoder.GetFromLocation (System.Double latitude, System.Double longitude, System.Int32 maxResults) [0x0004b] in <a10f61e70eeb434e952fef884856c199>:0
at Android.Locations.Geocoder+<>c__DisplayClass15_0.<GetFromLocationAsync>b__0 () [0x00000] in <a10f61e70eeb434e952fef884856c199>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <43dbbdc147f2482093d8409abb04c233>:0
at System.Threading.Tasks.Task.Execute () [0x00010] in <43dbbdc147f2482093d8409abb04c233>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0
at Xamarin.Essentials.Geocoding+<PlatformGetPlacemarksAsync>d__3.MoveNext () [0x0003d] in D:\a\1\s\Xamarin.Essentials\Geocoding\Geocoding.android.cs:15
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0
at GetLocation.MainPage+<btnGetAddress_Clicked>d__3.MoveNext () [0x00088] in C:\Users\Zahya\source\repos\GetLocation\GetLocation\GetLocation\MainPage.xaml.cs:60
--- End of managed Java.IO.IOException stack trace ---
java.io.IOException: Timed out waiting for response from server
at android.location.Geocoder.getFromLocation(Geocoder.java:136)
}
Related
When I compile the app in release mode I get the following error, I've already tried to reinstall and update all packages, but I still having problems with android in release mode. Any ideas? Thanks for any help :)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedField (Mono.Cecil.FieldReference reference) [0x00013] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.MarkField (Mono.Cecil.FieldReference reference) [0x00024] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction) [0x0002e] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x000c2] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x001b1] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x0001b] in <3e53085892e04b628169d0ea2d9ff8b6>:0
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00047] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue () [0x0000a] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.Process () [0x000f6] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000d] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at MonoDroid.Tuner.MonoDroidMarkStep.Process (Mono.Linker.LinkContext context) [0x0000b] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Pipeline.ProcessStep (Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) [0x0000d] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0000f] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x001dd] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Xamarin.Android.Tasks.LinkAssemblies.RunTask () [0x0001b] in <3e53085892e04b628169d0ea2d9ff8b6>:0
at Xamarin.Android.Tasks.AndroidTask.Execute () [0x00000] in <3e53085892e04b628169d0ea2d9ff8b6>:0 (XALNK7000) (vapaya.Android) ```
I'm using Xamarin.Auth to log into Facebook. I created a separate Renderer for iOS and Android.
In the auth.Completed I call a method AfterLogin(UserInfo) in the PCL class of the custom renderer. This does some additional work and then calls
App.Current.MainPage = new NavigationPage(new MainPage());
It looks like the page is constructed correctly and all methods return correctly until an Exception Unhandled gets thrown. The only text is "An unhandled exception occured."
In iOS, everything works fine. It calls the exact same PCL code.
I have no idea what view it is referring to.
Edit
Stack trace from ADB
I/MonoDroid(11638): UNHANDLED EXCEPTION:
I/MonoDroid(11638): Java.Lang.IllegalArgumentException: No view found for id 0x4 (unknown) for fragment FragmentContainer{436fa3e8 #0 id=0x4}
I/MonoDroid(11638): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d18287e1d683419a8ec3216fd78947b9>:0
I/MonoDroid(11638): at Java.Interop.JniEnvironment+InstanceMethods.CallBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00068] in <5716a943049b49ca928a3a1c8d2386f4>:0
I/MonoDroid(11638): at Android.Runtime.JNIEnv.CallBooleanMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <33e6e739ac344166b157e323586f11a1>:0
I/MonoDroid(11638): at Android.Support.V4.App.FragmentManagerInvoker.ExecutePendingTransactions () [0x00033] in <7e083afc7c9045f59e01d9c14931060d>:0
I/MonoDroid(11638): at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.Dispose (System.Boolean disposing) [0x00083] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:135
I/MonoDroid(11638): at Java.Lang.Object.Dispose () [0x00000] in <33e6e739ac344166b157e323586f11a1>:0
I/MonoDroid(11638): at Xamarin.Forms.Platform.Android.AppCompat.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x0003f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:226
I/MonoDroid(11638): at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x0001a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:370
I/MonoDroid(11638): at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.AppOnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x00012] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:321
I/MonoDroid(11638): at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:136
I/MonoDroid(11638): at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:380
I/MonoDroid(11638): at Xamarin.Forms.Application.set_MainPage (Xamarin.Forms.Page value) [0x0008b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Application.cs:90
I/MonoDroid(11638): at App.App.Instance_DataIsReady (System.Object sender, App.EventArguments.DataIsReadyEventArgs e) [0x0004d] in <9b95d86146df403c82b64e5a8ab6a9cf>:0
I/MonoDroid(11638): at (wrapper delegate-invoke) <Module>:invoke_void_object_DataIsReadyEventArgs (object,App.EventArguments.DataIsReadyEventArgs)
I/MonoDroid(11638): at App.DataCache.OnDataIsReady (App.EventArguments.DataIsReadyStates state) [0x0001b] in <9b95d86146df403c82b64e5a8ab6a9cf>:0
I/MonoDroid(11638): at App.DataCache.set_PlayerWinnings (System.Collections.Generic.IEnumerable`1[T] value) [0x00012] in <9b95d86146df403c82b64e5a8ab6a9cf>:0
I/MonoDroid(11638): at App.DataCache+<RefreshData>d__37.MoveNext () [0x00351] in <9b95d86146df403c82b64e5a8ab6a9cf>:0
I/MonoDroid(11638): --- End of stack trace from previous location where exception was thrown ---
Which version of Xamarin.Auth?
Why implementing Xamarin.Forms support if it is already in the library itself since version 1.5.0?
And for more help we'll need more info from your side (and your code)...
The issue turned out to be that MainPage was being assigned to twice. It wasn't related to Auth.
I don't know what's happening but PushSharp is not working anymore. I just updated to MacOS Sierra, but I'd like to believe it's not related to that.
This is my implementation (it was working one week ago):
var cert = new X509Certificate2(
"cio_aps_development.p12",
"",
X509KeyStorageFlags.Exportable);
var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, cert);
// Create a new broker
var apnsBroker = new ApnsServiceBroker(config);
This is the error:
2016-10-06 11:53:44.AM [ERROR] APNS-CLIENT[1]: Send Batch Error: Batch ID=1, Error=System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
at Mono.Security.Protocol.Tls.RecordProtocol.EndReceiveRecord (System.IAsyncResult asyncResult) [0x0003a] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:430
at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (System.IAsyncResult ar, System.Boolean ignoreEmpty) [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:256
at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (System.IAsyncResult result) [0x002c6] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:502
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (System.IAsyncResult result) [0x00035] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:396
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (System.IAsyncResult asyncResult) [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:101 ---> System.IO.IOException: Unable to write data to the transport connection: The socket is not connected. ---> System.Net.Sockets.SocketException: The socket is not connected
at System.Net.Sockets.Socket.BeginSend (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socket_flags, System.AsyncCallback callback, System.Object state) [0x00021] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System.Net.Sockets/Socket.cs:2564
at System.Net.Sockets.NetworkStream.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.AsyncCallback callback, System.Object state) [0x000b4] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System/net/System/Net/Sockets/NetworkStream.cs:934
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.AsyncCallback callback, System.Object state) [0x000f2] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System/net/System/Net/Sockets/NetworkStream.cs:954
at Mono.Security.Protocol.Tls.RecordProtocol.BeginSendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData, System.AsyncCallback callback, System.Object state) [0x00026] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:765
at Mono.Security.Protocol.Tls.RecordProtocol.SendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData) [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:786
at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (Mono.Security.Protocol.Tls.Alert alert) [0x00027] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:633
at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (System.Exception& ex) [0x00021] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:598
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.EndRead (System.IAsyncResult asyncResult) [0x00051] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:883
at Mono.Net.Security.Private.LegacySslStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x00011] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/Mono.Net.Security/LegacySslStream.cs:475
at Mono.Net.Security.Private.LegacySslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/Mono.Net.Security/LegacySslStream.cs:445
at Mono.Net.Security.Private.MonoSslStreamImpl.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/Mono.Net.Security/MonoSslStreamImpl.cs:77
at System.Net.Security.SslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System.Net.Security/SslStream.cs:147
at PushSharp.Apple.ApnsConnection+<connect>d__25.MoveNext () [0x00211] in <1389cefdb7bb4d6c97d6126934847d24>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
at PushSharp.Apple.ApnsConnection+<SendBatch>d__21.MoveNext () [0x00255] in <1389cefdb7bb4d6c97d6126934847d24>:0
2016-10-06 11:53:44.AM [INFO] APNS-Client[1]: Sent Batch, waiting for possible response...
Thread finished: <Thread Pool> #11
Thread started: <Thread Pool> #14
Apple Notification Failed: ID=1, Code=ConnectionError
Any ideas?
Thanks!
I'm working on a simple ProjectOxford Face and Emotion APIs demo with Xamarin.Forms
I added the Face and Emotion APIs from Nuget to the PCL Forms project and all platform-specific projects I get a TypeLoadException but the TypeName property is empty, so I don't know what's not loading.
The "Link Behavior" setting in the iOS project is "Don't Link" and the app runs in the simulator, selects a picture but when it hits the method that is supposed to send it to Face and Emotion APIs I get the exception below.
System.TypeLoadException: Failure has occurred while loading a type.
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00031] in /Library/Frameworks/Xamarin.iOS.framework/Versions/9.9.0.719/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
at HelloForms.FaceViewModel.DoAnalyzePhoto () [0x0000f] in <filename unknown>:0
at HelloForms.FaceViewModel+<FaceViewModel>c__async8.MoveNext () [0x00021] in .../HelloForms/XPlat/HelloForms/ViewModels/FaceViewModel.cs:115
at --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/9.9.0.719/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/9.9.0.719/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/1381/3afb4af5/source/maccore/src/UIKit/UIKitSynchronizationContext.cs:24
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/1381/3afb4af5/source/maccore/src/Foundation/NSAction.cs:163
at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/1381/3afb4af5/source/maccore/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/1381/3afb4af5/source/maccore/src/UIKit/UIApplication.cs:63
at HelloForms.iOS.Application.Main (System.String[] args) [0x00008] in .../HelloForms/XPlat/iOS/Main.cs:17
Some time i am facing issue of Connect Failure when I hit the web api in Xamarin IOS project. API is working fine and issue is in connection. If any one have an idea to solve this issue or have a link through which i can solve this issue.
please send me because i have tried many solution but couldn't solve it.
Error Log ::::::::::::::::
{System.AggregateException: One or more errors occurred. ---> System.Net.WebException: Error: ConnectFailure (Too many open files) ---> System.Net.Sockets.SocketException: Too many open files
at System.Net.Sockets.Socket..ctor (AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType) [0x00060] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net.Sockets/Socket.cs:214
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x000f6] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/WebConnection.cs:189
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00065] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:946
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (IAsyncResult iar, System.Func2 endFunction, System.Action1 endAction, System.Threading.Tasks.Task1 promise, Boolean requiresSynchronization) <0x1002da730 + 0x0005b> in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003b] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:199
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () <0x10027a4f0 + 0x0001b> in <filename unknown>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x003d6] in /Library/Frameworks/Xamarin.iOS.framework/Versions/9.6.1.9/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:372
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003b] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:199
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () <0x10027a4f0 + 0x0001b> in :0
at System.Net.Http.HttpClient+c__async0.MoveNext () [0x000a9] in /Library/Frameworks/Xamarin.iOS.framework/Versions/9.6.1.9/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:274
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (Boolean includeTaskCanceledExceptions) [0x00014] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2168
at System.Threading.Tasks.Task1[TResult].GetResultCore (Boolean waitCompletionNotification) <0x1002d9dc0 + 0x0006f> in <filename unknown>:0
at System.Threading.Tasks.Task1[TResult].get_Result () <0x1002d9d50 + 0x0002b> in :0
at RSystemApp.Controller.HolidayController.GetLeaveInformation (Int64 employeeId) [0x00025] in D:\Mukesh\TFSCode\RSIMobileApp\RSystemApp\RSystemApp\Controller\HolidayController.cs:83
---> (Inner Exception #0) System.Net.WebException: Error: ConnectFailure (Too many open files) ---> System.Net.Sockets.SocketException: Too many open files
at System.Net.Sockets.Socket..ctor (AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType) [0x00060] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net.Sockets/Socket.cs:214
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x000f6] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/WebConnection.cs:189
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00065] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:946
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (IAsyncResult iar, System.Func2 endFunction, System.Action1 endAction, System.Threading.Tasks.Task1 promise, Boolean requiresSynchronization) <0x1002da730 + 0x0005b> in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003b] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:199
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () <0x10027a4f0 + 0x0001b> in <filename unknown>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x003d6] in /Library/Frameworks/Xamarin.iOS.framework/Versions/9.6.1.9/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:372
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003b] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:199
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3051/5f11db87/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () <0x10027a4f0 + 0x0001b> in :0
at System.Net.Http.HttpClient+c__async0.MoveNext () [0x000a9] in /Library/Frameworks/Xamarin.iOS.framework/Versions/9.6.1.9/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:274 <---
}
How often do you call web API?
I have this problem before.
My code:
HttpClient client = new HttpClient ();
...
HttpResponseMessage response = await client.PostAsync (“webapi url” , postContent);
Solution:
using(HttpClient client = new HttpClient ())
{
...
HttpResponseMessage response = await client.PostAsync("webapi url" , postContent);
...
}
It seems like you don't dispose HttpClient
You can see this page:
https://dotblogs.com.tw/rainmaker/2016/06/06/103035
Hope you can fix it