Trouble deploying release version of Xamarin.Android app - c#

I'm getting the following error when the app finishes installing on the emulator using Xamarin Release run tool.
GREF GC Threshold: 1800
Unhandled Exception:
System.Net.WebException: Error: NameResolutionFailure
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at CallRestService.Activity1.<OnCreate>m__0 (IAsyncResult ar) [0x00000] in <filename unknown>:0
at System.Net.WebAsyncResult.CB (System.Object unused) [0x00000] in <filename unknown>:0
The emulator is running Android 2.3.3, and the Debug build ran from Xamarin compiler works just fine.
Any hint on why this is happening and how to solve this problem?

Had the same issue. Solved by adding <uses-permission android:name="android.permission.INTERNET" /> to the manifest.

Related

Unity on Linux with the Firebase plugin: WebSocket: ws_0 - could not connect

I must have broken something. I haven't done much with this project in a while (adding a scrollview to a scene) and tried running it in the editor today but this error occurred. It's using the Firebase plugin. The plugin has no trouble on the same project on a Mac.
My guess is .Net is somehow broken but I don't know how to debug or test that. Any help would be appreciated.
Current setup:
Elementary OS 0.4.1 Loki - Built on "Ubuntu 16.04.3 LTS"
Linux 4.4.0-109-generic
Unity 2017.2.0b2
Things I tried to fix it:
Try on a different version of Unity 2017.3.0b1 by setting up a brand new project, importing Firebase Analytics, Database, Messaging, and Auth.
Typed "System.Net.Sockets.Socket" which all autocompleted well but ".Connect" didn't show.
Tried on a different computer using the same OS and Unity and the same thing happened using just the Database plugin.
Upgraded to latest Firebase Unity SDK 4.4.0
Uninstalled and reinstalled Unity
Here is the error
1/24/2018 9:27:07 PM [Error] WebSocket: ws_0 - could not connect
System.Net.Sockets.SocketException: Network is unreachable
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
at System.Net.Sockets.TcpClient.Connect (System.Net.IPEndPoint remote_end_point) [0x00000] in <filename unknown>:0
at Firebase.Database.Internal.TubeSock.WebSocket.CreateSocket () [0x00000] in <filename unknown>:0
UnityEngine.Debug:LogError(Object)
Firebase.Platform.FirebaseLogger:LogMessage(PlatformLogLevel, String)
Firebase.Unity.UnityLoggingService:LogMessage(PlatformLogLevel, String)
Firebase.Database.Internal.Logging.DefaultLogger:Error(String, String)
Firebase.Database.Internal.Logging.DefaultLogger:OnLogMessage(Level, String, String, Int64)
Firebase.Database.Internal.Logging.LogWrapper:Error(String, Exception)
Firebase.Database.Internal.TubeSock.WebSocket:LogError(String, Exception)
Firebase.Database.Internal.TubeSock.WebSocket:CreateSocket()
Firebase.Database.Internal.TubeSock.WebSocket:RunReader()
Firebase.Database.Internal.TubeSock.Runnable101:Run()
Google.Sharpen.Thread:InternalRun()

mono Google Calendar Api v2 authentication error

We are busy with an application on a rasp pi where we retrieve a google calendar with the Google Calendar API. We wrote it in C# and tested it on Windows where i works fine. When we compile it on the Rasp PI (xbuild) we don't get any errors, but when we run (mono) it we get the following error:
Unhandled Exception: Google.GData.Client.GDataRequestException: Execution of request failed: http://www.google.com/calendar/feeds/USERNAME#gmail.com/private/full?start-min=2013-10-29T14:11:41Z ---> System.Net.WebException: The remote server returned an error: (401) Authorization required.
at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Google.GData.Client.GDataRequest.Execute () [0x00000] in <filename unknown>:0
at Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Google.GData.Client.GDataRequestException: Execution of request failed: http://www.google.com/calendar/feeds/USERNAME#gmail.com/private/full?start-min=2013-10-29T14:11:41Z ---> System.Net.WebException: The remote server returned an error: (401) Authorization required.
at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Google.GData.Client.GDataRequest.Execute () [0x00000] in <filename unknown>:0
at Google.GData.Client.GDataGAuthRequest.Execute (Int32 retryCounter) [0x00000] in <filename unknown>:0
Could someone help us, we don't see a solution.
We solved the authentification problem with running the following code:
mozroots --import --ask-remove
this is because Mono (by default) doesn't allow outside connections, so you have add it to the certificate list.

Assembly Injection into Live Processes (Mono)

I've recently came across the blog article Monovation: Assembly Injection into Live Processes of Miguel de Icaza.
I've tried to reproduce it with no luck. My command line was
'csharp --attach 5612'
where 5612 was the pid of a simple running mono 'Hello World' console application.
I've got an exception (see the stack trace above).
What I've tried so far:
using Mono 2.10.8 (csharp and csharp2 commands for .NET 4 and 2 )
using Mono 3.2.3 (only csharp command exists)
Q1: Missed I something?
Q2: Is it possible that this virtual machine attach facility (see Monovation: Assembly Injection into Live Processes) is available only in Linux installations? (I am using Windows 7) It sounds an easy answer, but Miguel does not mention platform restriction in his article, and the whole point of mono is the multiplatform, is not it? So I can not believe it so easy.
Q3: What about Mac? Is there any chance it will work in a Mac, or we must look elsewhere?
Thx in advance
Stack trace:
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---> System.EntryPointNotFoundException: Mono_Posix_Syscall_get_at_fdcwd
at (wrapper managed-to-native) Mono.Unix.Native.Syscall:get_at_fdcwd ()
at Mono.Unix.Native.Syscall..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Unix.UnixUserInfo.GetRealUserId () [0x00000] in <filename unknown>:0
at Mono.Unix.UnixUserInfo.GetRealUser () [0x00000] in <filename unknown>:0
at Mono.Attach.VirtualMachine.Attach (System.String agent, System.String args) [0x00000] in <filename unknown>:0
at Mono.ClientCSharpShell..ctor (Mono.CSharp.Evaluator evaluator, Int32 pid) [0x00000] in <filename unknown>:0
at Mono.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---> System.EntryPointNotFoundException: Mono_Posix_Syscall_get_at_fdcwd
at (wrapper managed-to-native) Mono.Unix.Native.Syscall:get_at_fdcwd ()
at Mono.Unix.Native.Syscall..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Unix.UnixUserInfo.GetRealUserId () [0x00000] in <filename unknown>:0
at Mono.Unix.UnixUserInfo.GetRealUser () [0x00000] in <filename unknown>:0
at Mono.Attach.VirtualMachine.Attach (System.String agent, System.String args) [0x00000] in <filename unknown>:0
at Mono.ClientCSharpShell..ctor (Mono.CSharp.Evaluator evaluator, Int32 pid) [0x00000] in <filename unknown>:0
at Mono.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0

Mono Consume WCF Service Fail ServiceClient Linux

I need help with this following exception. I am trying to consume a web WCF web service using basicHttpSecurity etc. I had a look at the Dev Pipe for Mono and what I am consuming is in the working section.
So the service im trying to consume is AccountService.svc. The proxy that is generated has a AccountServiceClient() object that I am using. On the line where you create the object it throws an exception and there is no way of debugging and stepping into that constructor.
The strange thing is that I can consume this service on my Windows Machine going though IIS. I can also consume with my Mac PC using the mod mono extension ect. But not on Ubuntu Linux machine. Can anyone shed some light on this? Can anyone explain why this is happening? How do I fix this?
Me creating a new instance of the client.
client = new AccountServiceClient ();
The AccountServiceClient() sniplet
public partial class AccountServiceClient : System.ServiceModel.ClientBase<EServicesAccountProxy.IAccountService>, EServicesAccountProxy.IAccountService
The exception that gets thrown.
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at System.ServiceModel.Configuration.ConfigUtil.GetTypeFromConfigString (System.String name, NamedConfigCategory category) [0x00000] in <filename unknown>:0
at System.ServiceModel.ChannelFactory.ApplyConfiguration (System.String endpointConfig) [0x00000] in <filename unknown>:0
at System.ServiceModel.ChannelFactory.InitializeEndpoint (System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0
at System.ServiceModel.ChannelFactory`1[EServicesAccountProxy.IAccountService]..ctor (System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService].Initialize (System.ServiceModel.InstanceContext instance, System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor (System.ServiceModel.InstanceContext instance, System.String endpointConfigurationName) [0x00000] in <filename unknown>:0
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor (System.ServiceModel.InstanceContext instance) [0x00000] in <filename unknown>:0
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor () [0x00000] in <filename unknown>:0
at EServicesAccountProxy.AccountServiceClient..ctor () [0x00000] in <filename unknown>:0
at TCShared.TCInsuranceSystem_EGW.GetAccount (TCShared.TCInsuranceSystemAccount objInsuranceSystemAccount) [0x00000] in <filename unknown>:0
A Strange thing i have noticed also is that I get a LoaderException as well (System.TypeLoadException). I don't know if it is related because the message says that it could not load type 'Npgsql.VisualStudio.NpgsqlObjectSelector' from 'Npgsql.VisualStudio, vserion=2.0.2.1, culture-neutral, PublicKeyToken=null'. Im not even using VisualStudio, im using monodevelop and XamarinStudio on my windows machine.
She source in the exception message says if comes from "mscorelib"
Any help will be appreciated.
Turns out there was an inner load exception and I had a Npgsql.VisualStudio DLL in my bin. Once i have removed that everything worked. Reflections failed to load that DLL because of missing references.

Mono 3.0/Debian/asp.net - Method not found: 'System.Configuration.IConfigurationSectionHandler.Create

Debian Sid, Mono 3.0. I'm trying to run mvc application (it worked before upgrading mono to 3.0). This is exception thrown:
Exception caught during reading the configuration file:
System.MissingMethodException: Method not found: 'System.Configuration.IConfigurationSectionHandler.Create'.
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0
at Mono.WebServer.Apache.Server.get_AppSettings () [0x00000] in <filename unknown>:0
at Mono.WebServer.Apache.Server+ApplicationSettings..ctor () [0x00000] in <filename unknown>:0
I've also found tip to make change in /usr/bin/mod-mono-server4 from:
#!/bin/sh
exec /usr/bin/mono $MONO_OPTIONS "/usr/lib/mono/4.0/mod-mono-server4.exe" "$#"
To:
#!/bin/sh
exec /usr/bin/mono $MONO_OPTIONS "/usr/lib/mono/4.5/mod-mono-server4.exe" "$#"
Unfortunatelly, there is no such file: /usr/lib/mono/4.5/mod-mono-server4.exe (no such file in /usr/lib/mono/4.5/ directory).
Do you have any ideas what's wrong? My application is ServiceStack simple webpage and it works on mono 2.10. But it doesn't work anymore after upgrade to 3.0.
You need to add a symbolic link for that file
# ln -s /usr/lib/mono/4.0/mod-mono-server4.exe /usr/lib/mono/4.5/mod-mono-server4.exe
That way it will still use mod-mono-server4.exe but with the 4.5 dll's

Categories

Resources