Xamarin.Forms Android app crashes on startup (in release build only) - visual-studio

I have a Xamarin.Forms Android app that runs reliably in debug build but crashes immediately, on startup, in release build.
My dev environment comprises of a Windows 10 PC with Visual Studio 2019, which is USB connected to the Android 9.0 device that I am testing against.
I have attempted to narrow down the cause of the issue by editing the Visual Studio release build configuration, one setting at a time, until it matches the working debug configuration. However, even with the release build config identical to the debug build config, the crash still occurs. Does this mean that Visual Studio is applying some other release build settings, apart from those configurable in the UI?
Is there any way to access diagnostic information from this crash? Any other suggestions how to identify the cause?
I am happy to post more details of the project configuration and development environment, if it helps.
Update: As suggested by several posters, I have retrieved the logcat data for the crash, but I am not sure how to interpret it, or where to go next:

Check the Device Log. It should contain Unhandled Exception Info for your App.
See here: View->Other Windows->Device Log - it is the Logcat's log, just in built-in to VisualStudio window.
Tip1: Open it before running your App, and choose your device in top-left.
Tip2: Watch the log immediately after the crash (better copy-it, paste into an editor), because it is overwhelmed by messages very quickly.

Related

Visual Studio Release build deploys to Hololens, but Master build doesn't - Activation of Windows Store failed

I am using spectator view for recording and streaming our Hololens app(link) and Visual Studio 2017 to build our solution for the Hololens.
I have been using the following Visual Studio build configurations:
Master, x86.
However, with the same configurations, the project with Spectator View fails with an error:
The program '[5620] SpecTest.exe' has exited with code -1073740966 (0xc000035a).
Activation of the Windows Store app 'SpecTest_s9y1p3hwd5qda!App' failed with error 'The app didn't start'.
We did notice that the app launched when we did a release build with the configuration:
Release, x86.
We require the Master build of the Hololens app because our project uses a Unity Timeline which for some reason doesn't work with the Release build. I searched the internet for this problem and tried almost every solution recommended there (Created a new license, deleted the bin folder and rebuilt the project, tried a Debug build). But, I believe it has something to do with the difference between the Release and Master build. We were previously able to do a master build without this Spectator View bit in our code.
Is there any way to do a Master build and overcome this error?

Unable to receive debug messages for crashing cordova app on windows 8.1 phone device

I have VS 2015 Enterprise RC installed and am in the process of porting a Cordova app, deployed on iOS and Android, to Windows 8.1 Phone / Universal
After making the necessary changes I have an App that crashes shortly after the splash screen is displayed on device.
I don't see any error messages in visual studio Error / Output windows or on the device. The app just vanishes
Can anyone provide a method to capture information surrounding critical app failure on the device in VS or otherwise for debug purposes?
I think it was because you got a native exception which cannot be captured by current debugger type. In classic windows phone project like c# and winjs project, we can set the debugger type to support both managed and native. I think it's worth to try if you can get more info by enable native debugger.
By default, for Cordova project, the default debugger type is Script only. We can find it out by enable Diagnostic build log: Tools->Options->Projects and Solutions -> change "MSBuild project build output verbosity" to Diagnostic.
Then let's take an example to show what we can find:
Create a new black cordova project.
Change Solution Platform to Windows Phone (Universal) and select "Emulator 8.1 WVGA 4 inch 512MB".
Build the solution. Then let's check the build log in output window.
When searching "debuggertype" in output window, we will be able to find the following info:
DebuggerFlavor = PhoneEmulator81Wvga4512
DebuggerType = Script
DebugSymbols = false
DebugSymbolsProjectOutputGroupDependsOn =
DefaultContentType = Default
DefaultReferenceGroup = Implicit (Apache Cordova)
DefineCommonReferenceSchemas =
DefineExplicitDefaults = true
We can see the DebuggerType was set to Script. This is inherited from globle settings in MSBuild. You will be able to find what the file is from the Diagnostic build output log as well.
Then let's see how we can change it to capture native exceptions. Go to your project folder and open .jsproj.user file. We can find the following setting:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Windows Phone (Universal)'">
<DebuggerFlavor>PhoneEmulator81Wvga4512</DebuggerFlavor>
</PropertyGroup>
Now, change it to the following will change the debugger type, you can verify that in build log.
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Windows Phone (Universal)'">
<DebuggerType>Mixed</DebuggerType>
<DebuggerFlavor>PhoneEmulator81Wvga4512</DebuggerFlavor>
</PropertyGroup>
Then you can run your app again to see if it will get any info in your visual studio output windows.
From my experience, debugging the solution from the platform/windows directory is easier but I don't know if that will help in your situation.
There is also plugin that helps with console.log logging.
The most popular bug in Windows Phone 8.1 / Universal Cordova apps is using libraries that manipulates DOM without Winstore Jscompat library. If you are using Angular, Ember, Knockout or something similar it causes the crash with first operation on DOM.
Windows Phone collects all crash data in a dump file. Activate this feature under:
Settings > Reports
After that, the dump files are created in the following folder on the phone:
WindowsPhone/Phone/Documents/Debug/
You can open an analyze them with Visual Studio.

Debugging Win Mobile 6 App with Visual Studio 2008

When I go in to debug the app, it asks me to choose where I would like to deploy it. When I select Windows Mobile 6.5.3 Professional Emulator and click the Deploy button, it starts to work and throws up a command line and then it goes away and Visual Studio doesn't appear to be in debug mode.
I have the Device Emulator open, Windows Mobile 6.5.3 Professional Emulator loaded and cradled. Can someone help me figure out why it will not let me debug this project?
Brad, I downloaded the code and just unpacked the zip to D:\boxoffice_mobile (a local drive partition). Then I started VisualStudio 2008 and opened the solution file. I get a warning message that the project is not loaded from a trusted location (http://msdn.microsoft.com/en-us/library/bs2bkwxc%28v=vs.80%29.aspx). As I do not use a network drive, I ignored the warning two times and the projects load all fine.
BTW: I found a great tool to manage these 'security' warnings: http://blog.codingoutloud.com/2010/03/05/the-project-location-is-not-trusted-dealing-with-the-dreaded-unblock/. The message had nothing to do with a remote file access.
Then I just looked at the solution configuration to ensure that only the needed projects are build and did no change, as only BoxOfficeMobile and WebserviceTest are set to build and only BoxOfficeMobile is set to deploy.
Then closed solution configuration manager and just pressed F5 to start debugging to see what happens.
The startup project BoxOfficeMobile was build and deployed to "Windows Mobile 6.5.3 Professional Emulator". The emulator started and the files were deployed and the project was stopped by a breakpoint inside the code:
Here is another screen shot with the emulator set to 'Display: Always on top':
So, as you can see, the project is fine and the debug issue on your site is caused by a different setup.
Do you load the project from a network drive share? Try moving it to a local drive and run it from there.
Did you change Device settings in the VS2008 Tools:Options menu? Here is my setup (as coming as default, I did not change anything):
and the details:
The additional settings available via the buttons are empty (Configure) or unchanged (Emulator Options).
I am very interested in seeing what you changed to be not able to debug the project.
before you start developing for Windows Mobile 6.5 Prof, you need to setup your development environment.
First, install Visual Studio 2008 (no express version)
Download and install either ActiveSync (host OS <= Windows XP) or Windows Mobile Device Center / WMDC (Windows Vista/7)
[optional] Download and install Device Emulator Manager
Then download and install Windows Mobile 6.5 DTK (http://www.microsoft.com/en-us/download/details.aspx?id=5389)
Now, you can start a new C# project inside Visual Studio 2008:
Follow the wizard:
The list of Target Platforms depend on the Mobile/CE SDKs you have installed!
Select either .Net Compact Framework 2.0 or 3.5. The choose depends on what is installed on your PC and what is available on the device. If the device comes with 2.0 pre-installed, I would choose 2.0 except for I need something only available in 3.5 (ie Mobile.Status namespace).
Now you get an empty form:
You can change the target device in the project properties:
If you want to change the target platform, look at "Change Target Platform" in Project menu or just right click the project in solution explorer and select Change Target Platform:
The above has nothing to do with Device Emulator Manager or the installed Emulator Images!
You can run a WM5 targeting project on a Windows Mobile 6.5 device if you want.
To start debugging and SmartDevice application inside an emulator. Just Select an Emulator entry from the target device list in Project properties or just in the SmartDevice toolbar. Then click Debug and "Start Debugging". VS will start an emulator with the specified emulator image and deploys your project application files and start remote devugging.
You may also start an emulator image using DeviceEmulatorManager and then cradle the running Emulator image. To use the running and cradled (ActiveSync or WMDC connected!) emulator do NOT select an emulator inside VS but a Device. VS does not see the difference and uses the WMDC connected device, regardless of being an emulator or real device.
VS uses DMA to communicate with the emulator, not USB or Serial as with a real device.
Now start your development.
First of all clean your project.Then freshly start the emulator.Right click the project and select build.Then Debug the project.Your project will be started in Emulator (Don't Open the application from your Emulator at this time).
Just check your Emulator Start>File Explorer>My Device>Program Files whether the project has been previously installed.If so uninstall from the Settings> System > Remove Programs. And try re-building application and deploy it.

Error debugging worker role in Azure

All the sudden started getting the following error while trying to debug a worker role:
"Windows Azure Tools for Microsoft Visual Studio
There was an error attaching the debugger to the role instance 'deployment16(360)blah blah' with Process Id: '8780'. Unable to attach. The Microsoft Visual Studio Remote Debugging Monitor has been closed on the remote machine."
Restarting Visual Studio and the machine do not help.
As you start getting this problem all of sudden in your development machine something must have changed and it is mostly due to some of the OS auto-update and/or some application update you installed in your machine. There could be any random reason for this problem however if I would have hit the exact same problem here is what I would do to troubleshoot such issue:
To start, first thing is to just check it is not an application specific problem by creating a base app from web/worker template and see if that exhibit the problem.
If you have installed new release Windows Azure SDK 1.7 check with both SDK 1.6 and 1.7 to verify if both exhibit the problem.
Check if your could debug IIS based application as well outside Compute Emulator. This will isolate if the problem is specific to Windows Azure development Fabric or bind to your IIS itself.
If this is IIS specific issue, Check IIS configuration for all enabled functionalities, try resetting Application Pool configuration, running "ASPnet_regiis -i" etc to fix the issue.
If it is Windows Azure Computer Emulator specific, I know sometime OS updates may make application unstable so in that case, I will re-install .net 4.0 and VS2010 SP1 again respectively. (This does help so many time) then re-install Azure SDK 1.7 completely.
Such random problem mostly occur due to some change in your machine configuration, so restoring the VS2010 and the re-installing all other application does help to solve problems.
If you have an exception in the role's OnStart() or in Application_Start() that the debugger doesn't pick up, you may also receive this message. Application_Start() errors are especially pernicious because the debugger doesn't attach to the web process until after this method returns.
If you are wedded to cloud specific classes such as RoleEnvironment and cannot make the web role a startup project, you can use Ctrl-F5 to run the cloud project without debugging. With some luck you'll get a yellow screen of death to show you the true error.
Avkash covers the points.
I had the same issue recently. I set my web project as start-up rather than Azure and I discovered that that web project didn't actually run. Turned out somehow when of my projects was compiling for X64. I changed that and it worked.

Unable to start/debug program

I recently installed Visual Studio 2010 to help me with some exercises for class.
It all worked great in school but when I got home and tried to run and debug the second program I got this error:
Unable to start ...\Kapitel_1\Debug\Kapitel_1.exe
This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, please see the application event log.
How can this be solved?
This message generally means that the machine on which you built the application did not have the same redistributables than the system where you run the application.
Redistributables are sets of DLLs needed for your application to run properly.
In your case, I noticed that you are trying to run a debug build. That might just be the problem: you cannot run an application or use a DLL that has been built in debug configuration on a system with no debugger installed. Installing Visual Studio (ideally the same version your school has) should do the trick. You could also rebuild your application in Release configuration to avoid having to install a debugger on the running system.
Another case where this error message might be displayed is if you just installed a new Visual Studio update on the system that built the application and not on the system where you are trying to run it. In that case, you would need to update your system with the latest set of redistributables from Microsoft (at time of writing, here was a good place to look for that).

Resources