I am trying to use Xamarin.UITest locally, but I am getting a httprequest exception, saying that the connection has been refused
I am using xcode 9.3, vs 7.4.2 and an iphone 10.3 iphone x sim
Xamarin.Ui.Test 2.2.4, Xamarin.Testcloud.Agent 0.21.4, NUnit 3.10.1
When Trying to run my test I get the following Exception:
Xamarin.UITest.XDB.Exceptions.DeviceAgentException : DeviceAgent start session failed: An error occurred while sending the request
----> System.Net.Http.HttpRequestException : An error occurred while sending the request
----> System.Net.WebException : Error: ConnectFailure (Connection refused)
----> System.Net.Sockets.SocketException : Connection refused
I got it working by restarting the mac and putting the Calabash.Start() call right on top of the FinishedLaunching method. If one or both saved the day, I don't know.
Although it's an old post, others might look for it.
That error means that the simulator doesn't start quickly enough for the next test.
There is an active bug opened here https://github.com/Microsoft/appcenter/issues/340#
What you can do is either set the variable to 0 and manually restart the emulator to pick the new code.
Also, be sure that NUnit package version is max 2.6.x. Newest 3.0 is not supported by Xamarin.UITest
Related
Using the AWS IoT Device SDK from GitHub, I'm testing from my local machine using the basic_discovery.py script I can see that it returns the IP address and port from my Raspberry PI running as a Greengrass device, however, I see that I'm getting invalid return codes from the subsequent request when it is attempting to connect with the PI device. The error messages I am getting are as follows:
Trying core arn:aws:iot:us-east-1:111111111111:thing/GreengrassPI at host 192.168.1.176 port 8883
[ERROR] [2022-07-20T20:42:02Z] [00007000017de000] [mqtt-client] - id=0x7fd8b24b4b60: invalid connect return code 4, disconnecting
[ERROR] [2022-07-20T20:42:02Z] [00007000017de000] [tls-handler] - id=0x7fd89242aba0: error reported during SSLRead. OSStatus code -9805
Connection failed with exception AWS_ERROR_MQTT_PROTOCOL_ERROR: Protocol error occurred.
All connection attempts failed
[ERROR] [2022-07-20T20:42:02Z] [0000000116728e00] [mqtt-client] - id=0x7fd8b24b4b60: Connection is not open, and may not be closed
Any suggestions as to what to check? I did not see anything on this in the troubleshooting guide.
[SOLVED] So what I found was that the device name I was using in the test script was not listed in the client device associations for the Greengrass core device. Adding the association resolved the problem. For anyone else that runs into something similar refer to this for information on associating devices. In summary what happened is that the script was able to look up the Greengrass core device but when it attempted to send an MQTT message to it, the Greengrass core device refused it because the device was not associated to it.
I have a Xamarin iOS app that connects to an API (written by me). Sometimes I suffer from a problem where the Simulators (running on Windows 10) will not connect to the API. Whereas the same code runs fine on an iPhone connected to the MAC on my network.
It throws the following exception:
{System.Net.Http.HttpRequestException: An SSL error has occurred and a secure connection to the server cannot be made.
---> Foundation.NSErrorException: Error Domain=NSURLErrorDomain Code=-1200
"An SSL error has occurred and a secure connection to the server cannot be made."
UserInfo={NSErrorFailingURLStringKey=https://api.staging.MyApp.com/api/v1/LogOn/,
NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?,
_kCFStreamErrorDomainKey=3,
_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <61E93B00-972D-4DF1-BA39-0141116988C2>.<1>,
_NSURLErrorRelatedURLSessionTaskErrorKey=(\n "LocalDataTask <61E93B00-972D-4DF1-BA39-0141116988C2>.<1>"\n),
NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made.,
NSErrorFailingURLKey=https://api.staging.MyApp.com/api/v1/LogOn/,
NSUnderlyingError=0x600001cac840 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0,
_kCFNetworkCFStreamSSLErrorOriginalValue=-9816,
_kCFStreamErrorDomainKey=3,
_kCFStreamErrorCodeKey=-9816}},
_kCFStreamErrorCodeKey=-9816}\n
--- End of inner exception stack trace ---\n
at System.Net.Http.NSUrlSessionHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x001d4] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/Foundation/NSUrlSessionHandler.cs:523 \n
at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task`1[TResult] sendTask,
System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts,
System.Boolean disposeCts) [0x0017e] in
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:506 \n at MyApp.Mobile.Api.LogOnUser (MyApp.Mobile.VM.LogOnVM vm) [0x000b2] in D:\Projects\MyAppCore\MyApp.Mobile\MyApp.Mobile\Api.cs:114 }
Just to repeat, the VERY SAME code is running on the physical iphone (and android emulators/phone) perfectly.
Any ideas as to why are appreciated. Thanks.
Following the information Jason provided, I decided to reboot the MAC. And voila! All working again.
I think it may be caused by me starting up 'ExpressVPN' on the PC. I noticed when that is running, the Android won't connect either. However, when I stop it, the Android is OK. But I suspect the Apple never works again until the MAC is rebooted. Not 100% sure that is the reason, but I hope this will help others.
OK - It was NOT the VPN. But rebooting the MAC seems to fix the issue every time.
I tried to build my Unity project on Universal Windows Platform for PC and I get the following error:
The error is: "Value does not fall within the expected range", in the line: "TcpClient = new TcpClient(ip, port);".
The ip is set to "127.0.0.1" and the port to 6666, but even if I run the TcpClient construction method that takes no ip and port, I still get the same error.
The projects works even with this error, except that the TCP client isn't connecting to the server.
I am working on Unity 2019.3.5f1, and this error occurs only when I am running the Universal Windows Platform build.
In the editor or in other types of builds it works fine.
EDIT:
After some more research I found that the error is in the SetSocketOption method, that is called by the TcpClient constructing method.
Running Instruments from the command line I started getting this:
instruments[2387:30342] Connection peer refused channel request for "com.apple.instruments.server.services.wireless"; channel canceled <DTXChannel: 0x7fa7116b7a10>
Any idea what the problem is and how to fix?
I'm also doing some research to find out the root cause of the problem. However, making sure Instruments is not running and/or restarting the device solved the issue.
We stopped being able to connect to the feedback.sandbox.push.apple.com about two days ago right in the middle of testing. I checked the certificate and it is valid. I also ran the openssl troubleshooting commands... and it all appeared ok. But we also can NOT doing any testing or work against the sandbox APNS. We are getting the following error about a malformed message response when we try and create the SSLStream connection. I have been scratching my head for a day now... thinking it was something on our end... so would really appreciate a response if others are able to test and connect to the sandbox APNS using PushSharp current version 2.1.2 ??
A call to SSPI failed, see Inner exception" Inner Exception -> "The message received was unexpected or badly formatted."
We were having the same issue using the now deprecated APNS-Sharp library (ancestor to PushSharp). I submitted a pull request for APNS-Sharp that fixes the issue based on my tests.
See https://stackoverflow.com/a/23121258/3542341
and for the pull request: https://github.com/Redth/PushSharp/pull/369/files