Microsoft.AppCenter.Crashes not detecting crashes on Xamarin.Forms iOS project - c#

I recently tried to implement Microsoft.AppCenter.Crashes to help track down crashes in my team's Xamarin.Forms app. However, when a crash happens on our iOS project, AppCenter never detects it. I've created the following function for setup and checking, which gets called near the start of our central project's App.xaml.cs App constructor:
private async Task CheckForPreviousCrash()
{
//Setup AppCenter
await Xamarin.Forms.Device.InvokeOnMainThreadAsync(() =>
{
//Keys changed in StackOverflow post for security reasons.
AppCenter.Start("ios=########-####-####-####-############;android=########-####-####-####-############;uwp=########-####-####-####-############", typeof(Crashes));
AppCenter.IsNetworkRequestsAllowed = false; //Prevents sending user data to Microsoft. Required by company
});
//Make sure AppCenter is working
bool isEnabled = await Crashes.IsEnabledAsync();
if (!isEnabled)
{
_logger.LogError("AppCenter could not be started");
}
else
{
//Check for memory leak warnings
bool memoryIssue = await Crashes.HasReceivedMemoryWarningInLastSessionAsync();
if (memoryIssue)
{
_logger.LogError("AppCenter detected a memory warning in the last session");
}
//Check for crash info
bool crashed = await Crashes.HasCrashedInLastSessionAsync();
if (crashed)
{
var report = await Crashes.GetLastSessionCrashReportAsync();
_logger.LogCrashReport(report);
}
//If AppCenter detected no issues in the last session, log an "all clear" message
if (!memoryIssue && !crashed)
{
_logger.LogInformation("AppCenter did not detect a crash in the last session");
}
}
}
I've tested this code using the Crashes.GenerateTestCrash() function, one of the crashes my team is trying to resolve, and a simple recursive function that calls itself forever. When run on iOS, our logs will always show the "AppCenter did not detect a crash in the last session" message, regardless of if a crash occurred. Any help determining what could be causing this would be appreciated.
Notes:
The iOS project is always run without a debugger attached. I'm aware of the rule that crash reports will not be generated if iOS has a debugger attached
This has been seen when built using both Debug and Release mode
This code works as expected on our Android and UWP projects
The iOS project always passes the isEnabled check
This is running AppCenter and AppCenter.Crashes version 4.5.0
This is running on a 7th gen iPad on iOS 15.2.1
EDIT: Extra notes in response to a suggested answer:
The Mac used to build the iOS project is running macOS 11.6.2
Project is built using XCode 13.2.1
The Xamarin Forms project is built in Visual Studio 2019 16.11.7, and sent to the connected mac via Visual Studio's "Pair to Mac" feature
There are no other libraries used for crash reporting (the closest used is Serilog, which should only be handling logging)
We do not use CocoaPods to integrate AppCenter

You can check if you meet the requirements as following shows:
-Your iOS project is set up in Xcode 11 or later on macOS version 10.14.4 or later.
-You're targeting devices running on iOS 9.0 or later.
-You're not using any other library that provides Crash Reporting functionality (only for App Center Crashes).
-If you are using CocoaPods to integrate App Center, you need CocoaPods version 1.10 or later.
App Center SDK Analytics and Crashes are compatible with Mac Catalyst via XCFramework or SwiftPM.
Here are more detail about appcenter crashed on ios https://learn.microsoft.com/en-us/appcenter/sdk/getting-started/ios

Related

Creating a CosmosDB database locally with C# code throws an Internal Server error

I try to create a database in the local cosmosDB emulator but this fails to work. It throws an exception with the following message:
Response status code does not indicate success: InternalServerError
(500); Substatus: 0; ActivityId: 36f6a95d-26d7-4ecd-9c81-f6df220f3cdc;
Reason: (Unknown server error occurred when processing this request.
ActivityId: 36f6a95d-26d7-4ecd-9c81-f6df220f3cdc,
Microsoft.Azure.Documents.Common/2.14.0,
Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum,
Windows/10.0.19042 cosmos-netstandard-sdk/3.24.1);
This error happens in my project as well as in an simple, empty console app only containing these lines of code:
using Microsoft.Azure.Cosmos;
namespace CosmosDBTest;
class Program
{
public static async Task Main()
{
using var client = new CosmosClient("<A local connection string>");
var response = await client.CreateDatabaseIfNotExistsAsync("test", 500);
var database = response.Database;
await database.CreateContainerIfNotExistsAsync("container1", "id");
}
}
The version of the emulator I use is 2.14.6. The version of the NuGet package is 3.26.1
What is causing this exception and how do I solve this? I has worked with older versions of the emulator in combination of an older version of the NuGet package. But before I downgrade the emulator and/or package, I want to find out if there is a better work around.
I haven't tried the demo application which is offered by the emulator. Funny enough as it is on a tab with the name ".NET" (and another tab .NET core next to it) the ".NET" example is written in the very old version .net core 2.1 which I don't have installed even.
Try resetting the Emulator, this looks like a malfunction on the Emulator itself. The HTTP 500 is coming from the Emulator, the SDK is just surfacing the response.
Reference: https://learn.microsoft.com/azure/cosmos-db/troubleshoot-local-emulator
If you installed a new version of the emulator and are experiencing errors, ensure you reset your data. You can reset your data by right-clicking the Azure Cosmos DB Emulator icon on the system tray, and then clicking Reset Data…. If that does not fix the errors, you can uninstall the emulator and any older versions of the emulator if found, remove C:\Program files\Azure Cosmos DB Emulator directory and reinstall the emulator.
Alternatively if resetting the data doesn't work, navigate to %LOCALAPPDATA%\CosmosDBEmulator location and delete the folder.

ML.NET: strange runtime error on some machines

I wrote a simple UWP app using the ML.NET framework, and it worked on one of my machines without installing any Nuget packages, without any additional setup etc.
However, on my other machine, after running the application, I get this error:
System.Runtime.InteropServices.COMException: 'Unspecified error
No suitable kernel definition found for op Sub (node Minus675)'
The error happens in this segment of code:
public static async Task<modelModel> CreateFromStreamAsync(IRandomAccessStreamReference stream)
{
modelModel learningModel = new modelModel();
learningModel.model = await LearningModel.LoadFromStreamAsync(stream);
learningModel.session = new LearningModelSession(learningModel.model); // it breaks here
learningModel.binding = new LearningModelBinding(learningModel.session);
return learningModel;
}
In case anyone should ask - yes I have added my .onnx model in the Assets folder. My configuration is: VS 2017, Windows 10 version 1809, build 17763.194, and I have Windows 10 SDK version 10.0.17763.132. I have tried installing the Visual Studio Tools for AI and ML.NET Templates VS extensions, but it didn't help.

MdilXapCompile.exe -- Windows Phone Device Deployment Error

I'm trying to deploy my appo to my Lumia 930 so I can test it on something other than an emulator, but every time I hit F5 it basses the build but crashes on deplyment.
MIDLXapCompile log file:
CrossGen failed
Error processing assembly C:\Users\mrrey_000\Dropbox\Dev\Windows Store\AnimeWatcherXYZ EX Summer\AnimeWatcherXYZ.WindowsPhone\obj\ARM\Debug\MSIL\Microsoft.Advertising.Mobile.Display.winmd
Raw error code: 2148733978
I tried deleting the reference to the Microsoft Advertising SDK and applying i oce again, I've also tried to remove the previous version of the app from my device - didn't help.
And yeah, I'm deploying a DEBUG package, not RELEASE.
How can I fix this?

Linking failed when using Hockey SDK in Xamarin IOS App

I have a Xamarin.forms app. In the iOS project I installed the HockeyApp package from here and followed the samples here by adding the following code in my AppDelegate.cs:
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
//We MUST wrap our setup in this block to wire up
// Mono's SIGSEGV and SIGBUS signals
HockeyApp.Setup.EnableCustomCrashReporting (() => {
//Get the shared instance
var manager = BITHockeyManager.SharedHockeyManager;
//Configure it to use our APP_ID
manager.Configure ("YOUR-HOCKEYAPP-APPID");
//Start the manager
manager.StartManager ();
//Authenticate (there are other authentication options)
manager.Authenticator.AuthenticateInstallation ();
//Rethrow any unhandled .NET exceptions as native iOS
// exceptions so the stack traces appear nicely in HockeyApp
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
Setup.ThrowExceptionAsNative(e.ExceptionObject);
TaskScheduler.UnobservedTaskException += (sender, e) =>
Setup.ThrowExceptionAsNative(e.Exception);
});
//The rest of your code here
// ...
}
As soon as I try to compile the program Visual Studio throws the following error (and some more of that kind):
Severity Code Description Project File Line Suppression State
Error Native linking failed, undefined symbol:
std::__1::__vector_base_common::__throw_length_error() const.
Please verify that all the necessary frameworks have been referenced
and native libraries are properly linked in. App.iOS
When I comment that code piece everything runs fine.
Any suggestions on that? Anybody who successfully setup Hockey in an ios xamarin forms project?
Are you targeting iOS 6?
If so from the getting started section on the HockeyApp Component it states this:
Targeting iOS 6.0
If you would like your app to target iOS 6.0 you will need to add the following arguments to your application project settings.
Open project Options
Under Build -> iOS Build
Go to the Additional Options -> Additional mtouch arguments and add:
-cxx ->gcc_flags "-lc++"
Also this bug says the same thing

Binding UIImageView invalid cast in Xamarin after upgrade

I recently tried to recompile a project that had been working in a newer version of Xamarin. The project compiles, but crashes on the device with an invalid cast exception.
System.InvalidCastException: Cannot cast from source type to destination type.
The crash occurs in designer generated code:
[MonoTouch.Foundation.Connect("turnOnAnimation")]
private MonoTouch.UIKit.UIImageView turnOnAnimation {
get {
object test = this.GetNativeField ("turnOnAnimation");
**this.__mt_turnOnAnimation = ((MonoTouch.UIKit.UIImageView)(this.GetNativeField("turnOnAnimation")));**
return this.__mt_turnOnAnimation;
}
set {
this.__mt_turnOnAnimation = value;
this.SetNativeField("turnOnAnimation", value);
}
}
Studying the return from GetNativeField, I seem to be getting a UIView instead of a UIImageView back:
But the outlet in the XIB is connected to a UIImageView.
To my knowledge this code was working fine with earlier versions. Has something changed in recent versions or should I be doing something differently?
Additional testing showed:
1) This problem occurred on an iPod touch running iOS version 7.1.1
2) The problem did not occur in the simulator running iOS 8.1 (any iOS platform)
3) The problem did not occur on an iPhone running 8.1.2
4) Upgrading the iPod touch to iOS 8.1.3 resolved the issue.
I conclude this was either an iOS bug or an incompatibility between current Xamarin tooling and the older version of iOS.

Categories

Resources