HttpClient.PostAsync not complete with wrong DNS server , ios app frozen - xamarin.ios

Steps to Reproduce
Setting wrong DNS at Ipad wifi setting (ex: 5.6.7.8)
Run App, Request HttpClient.PostAsync
App Frozen
Expected Behavior
Response Error in Catch()
Actual Behavior
App Frozen
Environment
Microsoft Visual Studio Enterprise 2019
Version 16.5.2
Xamarin.iOS and Xamarin.Mac SDK 13.16.0.11
Ipad Ios 12, 13, 14
System.Net.Http 4.3.4
I have a Xamarin.Ios application, which has a function that uses HttpClient.PostAsync
In case the Ipad is setting DNS correctly, the app works normally, no problem
However, when the DNS setting is wrong, the app will freeze, when running to handle HttpClient.PostAsync
At the output, I'm seeing that Task PostAsync cannot be completed (for a long time there is still no error at Catch())
I have tried on many different devices
and also try on different versions of System.Net
But still can't solve

This can happen if you are running that command on the UI thread. In that case that is expected to happen. As such you need to start the process on a new thread using System.Tasks.Task.Run.

Related

Remote debug Azure web job with .NET 6 in Visual Studio 2022

I followed this tutorial to create a simple web job in Azure: https://learn.microsoft.com/en-us/azure/app-service/webjobs-sdk-get-started. The web job itself does its job, consumes the message in the queue and I see them appear in Application Insights.
However, I want to debug the function on my local machine by using the tools available in Visual Studio 2022.
I have published with following profile settings:
Next I've attached the debugger under het Hosting menu:
First thing I noticed is a message about no symbols being loaded when putting a breakpoint in the function:
When I add a message to my queue, it gets consumed by the web job but the breakpoint is never hit. I've been reading a lot of similar questions regarding a this issue but I'm not progressing any further.
In Azure Portal, I've enabled Remote debugging under Configuration > general settings
In Visual Studio 2022, I checked if the correct process is attached
Here I'm a bit confused thou, the connection target is connecting through port 4024, which is according to this document, the port for Visual Studio 2019. However, a connection target with port 4026 is not found.
What am I missing here? Am I forgetting another setting somewhere?
If have tried changing the stack setting .NET version from APS.NET V4.8 to NET 6 (LTS) but that didn't help.
Should the platform architecture match the architecture of my machine in order to get it to work? Or is this not linked in any way with the debugger?
Is there anything else that I should check or try? Because my hair is turning grey here :)
Apologies for the delay here!
It should be 4024 for both 32 and 64 bit.
See this Azure doc: Remote Debugger Ports on Microsoft Azure App Service
Typically, the error “The breakpoint will not currently be hit. No symbols have been loaded for this document.” -- This error message indicates we can start debug process and attach, but cannot set a breakpoint on any or some lines of code in the project.
Most, likely cause: Application is built without debug symbols or debug symbols are not available
Kindly try these steps:
Verify Debug Symbols are being used and published and in sync
Workaround the issue by disabling “Enable Just My Code” from the
Tools >> Options >> Debugging >> general menu in Visual Studio
Other things to narrow-down the issue:
Debug symbols must be available locally or deployed to the Azure App Service, and must match the local code you are trying to debug.
It is recommended to use Cloud Explorer over Server Explorer to
connect and debug which requires the Azure SDK.
You could optionally Manually Attach a Debugger to Azure Web Apps to troubleshoot this further or recommend this as a workaround.
(old blog, try similar steps)
Kindly verify the port (Visual Studio remote debugger port assignments ) required is open in the corporate firewall and on your local machine.
As a test, you may use tool like Wireshark/netmon, to see if the port successfully connects to the port (4024) needed by the process.

iOS debugging is terminated directly after it started (Xamarin.Forms / VS for Mac)

I'm currently trying to debug an iOS application (created with Xamarin.Forms) with VS for Mac (also tested through VS2019 Enterprise on Windows). Unfortunately, the debugging process is not started successfully. It stops without any exception or error report (except "Application 'com.XYZ.MyApp' terminated." which is not helpful at all). This happens with the simulator and the device debugging.
When debugging it shows the launch screen and from time to time the following page. Then the debugging crashes without any report. This may be caused by an asyncronous process. However, there is no information in the log files.
The same app can be successfully debugged with the andriod simulator. Moreover, a generally similiar application can be debugged under iOS.
Is there any possibility to get a more detailed error report that shows why the debugger is closing?
Edit: I just created a TestFlight version which works pretty stable and pretty well... So I have no clue anymore why the debugging is not working... Is it maybe because I had Xcode 11 beta installed for a short time to test iOS 13 on my device with my apps? I uninstalled Xcode 11 after the iOS update but is there a chance that this causes problems with the Xcode 10 installation?

visual studio 2017 remote debugging azure api app: "The breakpoint will not currently be hit. No symbols have been loaded for this document."

I'm trying to remote debug an asp.net core 1.1 api app (targeting .net framework 4.5.2) that's running on Azure.
I attach the debugger via Server Explorer. The debugger attaches to the correct process. But any breakpoint I set has the message "The breakpoint will not currently be hit. No symbols have been loaded for this document."
All answers I've seen to such a problem assume that the modules window shows all modules loaded by my project, but in my case the modules window is empty!
I'm on VS2017 15.4.
If I remember correctly, I was previously able to remote debug the same project with version 15.2. The problem started occurring when I updated to 15.3 but I didn't pursue it at the time.
I submitted the problem on the MS forums: Can't remote debug Azure API app
and now I have received an official reply that it is indeed a bug in VS, and a fix will be available in the pending release (15.6).
They also suggested a workaround, which I tried and indeed worked: Manually Attach a Debugger to Azure Web Apps
Which involves:
Going to the web app Application settings in the Azure portal, and making sure that Remote debugging is enabled,
In the VS menu: Debug > Attach to Process..., entering the web app url with the debugging port, e.g.:
myapp.azurewebsites.net:4022
Then in the credentials that appears, entering the username & password that are available in the app's Publish Profile, which can be downloaded from the portal. If the username is $myapp, it should be entered like this:
$myappp\$myapp
Then choosing Managed(v4.6, v4.5, v4.0) code and then the name of the Core app.
Actually, I had found and unsuccessfully tried similar approaches before. The key for me was step 3. The others had suggested entering the username as .\$myapp, or myapp\$myapp. So make sure to enter it as written above.
BTW, seeing that the above blog post is from almost 2 years ago (Feb 2016), whereas the problem I'm experiencing was introduced only a few months ago, it seems to be a cure-all, and it is therefore worthwhile, for anyone who has to deal with remote debugging Azure apps, to save this information for future reference.
UPDATE:
After updating VS 2017 to version 15.5.2 the problem seems to have been fixed.
I have had the same issue with Visual Studio 2019. The fix for me was just to go in the VS menu: Debug > Attach to Process, and try to connect as describe by #Dan Z. The connection was not established, saying No connections found, but attaching a debugger from Cloud Explorer again, right after an attempt in "Debug > Attach to Process" is always successful. That is most probably a bug in VS

Error running app on Windows Phone 8.1 emulator - A dependent dll was not found

I have universal project targeting Windows Store 8.1 and Windows Phone 8.1 platform.
The windows one works fine but I having trouble running the WP one on an emulator. I get the error message saying:
Microsoft Visual Studio Unable to activate Windows Store app
'numbers-here!App'. The Kiss.WindowsPhone.exe process started, but the
activation request failed with error 'Msg in polish that the app did
not start'.
If this was Windows I would check System Event Log and see the logs just before the error what DLL the system was trying to load and that helped a lot when I was debugging similar problem with Windows Store project, here I have no clue on how to check what exactly was being loaded.
The worst part is that I created package (appx) and checked the dll's being packed with exe, it seems that it includes dependencies that the app explicility uses yet something is still missing and this might be some 'hidden' dependency of one of the other dlls.
Any ideas how to debug such issues with emulator?
For me it was due to having WIC code in my App and/or calling CoCreateInstance in a windows phone environment ( on PC it works flawlessly though )
I ran into the same problem on Windows 10. Turns out, that there is no Kernel32.dll on Windows 10 phone!
Instead you need to link against OneCore.lib which provides the entire Win32 API subset that is supported in UWP. This "umbrella library" will load the correct dlls at runtime.
See also:
https://msdn.microsoft.com/en-us/library/windows/desktop/mt683763(v=vs.85).aspx

My MonoTouch App won't run on 6.1.3, runs on 6.0.x and before... WTF?

I just pushed my app to the App Store after building release/AppStore build using xamarin's Studio...
Everything was green lighted and ready to go, I only had one person who had not installed the release version.... They installed it and it takes 17 seconds to try to start and is killed (I presume). it does NOT create a crash log on the device.
In the Settings there is a "Debug Settings" section under the app - that I didn't put there, including an option for Xamarin Studio Host which is set to automatic but appears to be able to be set to some other string.. (Another message on what the heck this is, and how come it shows up in the first place, and how to get rid of it)
I'm at a loss how to debug this. I just downloaded and upgraded XCode to the latest, in hopes that will help.. (Although, I'm not using the XCode interface to build, but I expect that under the hood it is using that for parts of this, maybe the libraries or something.) Still, unless the iOS writers are nuts, it should be backward compatible with apps written for iOS 4.0 and later... (Mine is a 4.0 targeted app)
Also, on her phone (which has always been 6.x for all the testing she has done), my app has always taken a LONG time to start up.. but on 5.1 it is very fast.. (I.E. 1-2 seconds vs 10+ seconds on her phone)
Anyone got a clue, I sure could use one right now.. I expect that I'll have to reject the binary, and submit another one...
-Chert
Figured it out.... The issue was with the TestFlightApp SDK...
I removed it and now the app starts up OK... Resubmitted to App Store for approval.

Resources