I have a "hard to read" crashlytics log in a live Xamarin iOS app. This issue affects almost 80% of the users and I am struggling to decipher it.
Please have a look at the log in this gist
I have uploaded the dSYM file in the Crashlytics dashboard but the log remains the same. Is it normal for a Xamarin App this type of log?
I do not even know what source file of the app causes the crash.
I have the following code in AppDelegate.cs:
override public bool FinishedLaunching (UIApplication application, NSDictionary launchOptions){
//...
Setup.EnableCrashReporting (() => {
var crashlytics = Crashlytics.SharedInstance;
crashlytics.DebugMode = true;
Crashlytics.StartWithAPIKey ("my_key");
Fabric.With (new NSObject[]{ crashlytics });
AppDomain.CurrentDomain.UnhandledException += AppDomain_CurrentDomain_UnhandledException;
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
}, Path.GetFileNameWithoutExtension (typeof(AppDelegate).Module.Name));
}
and the following methods:
void TaskScheduler_UnobservedTaskException (object sender, UnobservedTaskExceptionEventArgs e)
{
var ex = e.Exception;
Setup.CaptureManagedInfo(ex);
Setup.CaptureStackFrames(ex);
Setup.ThrowExceptionAsNative(ex);
}
void AppDomain_CurrentDomain_UnhandledException (object sender, UnhandledExceptionEventArgs e)
{
Setup.CaptureManagedInfo(e.ExceptionObject);
Setup.CaptureStackFrames(e.ExceptionObject);
Setup.ThrowExceptionAsNative(e.ExceptionObject);
}
Am I missing something on Fabric configuration here?
Related
I'm a new xamarin developer and this is my first post :)
So, I'm develop a xamarin forms application with prism framework. Everything works in debug mode but in release mode the app crash on start on ios.
This is my OnInitialized function
protected override async void OnInitialized()
{
try
{
InitializeComponent();
if (DataContext.GetContext().CurrentUser == null)
{
if ((await NavigationService.NavigateAsync(nameof(LoginScreen))).Exception is Exception e)
throw e;
}
else
{
if ((await NavigationService.NavigateAsync("NavigationPage/MainScreen")).Exception is Exception e)
throw e;
}
}
catch (Exception ex)
{
Debug.WriteLine($"[ERR] in {nameof(OnInitialized)}");
Debug.WriteLine(ex.Message);
await UserDialogs.Instance.AlertAsync(AppResources.Error_Label);
}
However when I debug in release mode with check "Enable debugging" i catch an exception that said "navigation uri is empty". I dont understand why.
Debug option in release mode
All advice is welcome, thanks in advance
I am working on Xamarin.Forms app and it's working perfectly fine on Android device. Anyway, when I am trying to run it on iPhone simulator it's just showing the main screen of the app, but none of the features are working.
The main screen consists of two parts of which one is to browse and open files and the other is to open a menu. The layout consists of Browse, process and exit buttons and when I click on the browse button to open file explorer an alert is displayed, that something went wrong.
I enabled breakpoints and tried debugging it, but the control is going to catch exception part directly.
Here is the code for it can anyone please help me with this part? I am using Xamarin.Plugin.Filepicker NuGet package. When I place the cursor on the Exception I can see that
System.NotImplemented Exception:This functionality is not implemented in the portable version of this assembly,you should reference the NuGet Package from your main application project in order to reference the platform specific
and the code is
private Plugin.FilePicker.Abstractions.FileData file =
default(Plugin.FilePicker.Abstractions.FileData);
public async void OnBrowse(object o, EventArgs args)
{
try
{
// var file_path =
this.file = await CrossFilePicker.Current.PickFile();
if (this.file == null)
{
return;
}
string extensionType = this.file.FileName.Substring(
this.file.FileName.LastIndexOf(".",
StringComparison.Ordinal) + 1,
this.file.FileName.Length -
this.file.FileName.LastIndexOf(".", StringComparison.Ordinal) -
1).ToLower();
fileName = this.file.FileName;
if (extensionType.Equals("csv"))
{
csv_file.Text = (fileName);
}
else
{
await this.DisplayAlert("Name of the file:" + file.FileName, "File info", "OK");
}
if (SettingsPage.loggingEnabled)
{
LogUtilPage.Initialize("/storage/emulated/0");
}
}
catch (Exception e)
{
await DisplayAlert("Alert", "Something went wrong", "OK");
if (SettingsPage.loggingEnabled)
{
LogUtilPage.Log(e.Message);
}
}
}
This question already has answers here:
Publishing issue, Callkit is included even we are not using it
(2 answers)
Closed 5 years ago.
I have an app which enables an user to make phone call to a certain number. I am doing following:-
private void CallContact(string phone)
{
phone = phone.Replace(" ", "");
var callURL = new NSUrl("tel:" + phone);
try
{
if (UIApplication.SharedApplication.CanOpenUrl(callURL))
{
UIApplication.SharedApplication.OpenUrl(callURL);
}
else
{
var av = new UIAlertView("Not supported",
"Calling is not supported on this device",
null,
"OK",
null);
av.Show();
}
}
catch (Exception ex)
{
return;
}
}
This works fine. But when I tried publishing the app, my app got rejected and the Apple team asked me the following:-
We noticed that your app has CallKit and CallKit Blocker enabled:
⁃Which features of your app require CallKit and CallKit Blocker functionality?
⁃Where, specifically, in the app would users access these features?
I am not using the CallKit functionality anywhere in my app. I searched SO and found that it is shipped with the Xamarin.iOS.dll . It is possible that the way I am making calls in my app uses the CallKit?
Sorry for bein a noob :)
try this solution
partial void BtnContactBillingCall_TouchUpInside (UIButton sender)
{
var confirm = new UIAlertView("","Call "+ mobilenumber + " ?",null,"Cancel","Call");
confirm.Show();
confirm.Clicked += (object senderConfirm, UIButtonEventArgs e) =>
{
if(e.ButtonIndex ==0)
{
}
else
{
var url = new Foundation.NSUrl("tel:"+mBillingPhoneNumber);
UIApplication.SharedApplication.OpenUrl(url);
}
};
}
I have an MVC Web API project that I am working on. I created a controller with an action. I am able to hit the action properly using Postman, but when an external system tries to reach my controller, it gets a 500 error. The owner of the external service cannot give me any details beyond that, they can only retry the request.
Here is one of the log entries of their requests in IIS log
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-02-15 20:38:58 192.168.2.34 POST /Route/to/actionName 8002 - 192.168.2.37 Apache-HttpClient/4.5.2+(Java/1.8.0_102) - 500 0 0 146
First I thought may be the action is being hit, so I added an exception handler and added logging.
[Route("actionName")]
[HttpPost]
public IHttpActionResult actionName(MessageModel message)
{
try
{
// code to handle the action
}
catch (Exception e)
{
// Code to log exception in the log file
}
}
Tried above and saw nothing in the log, I have run tests for failed requests to make sure the above exception handler logs and it does.
So the next thing I decided to do was to handle application level errors in Global.asax and log exception there.
protected void Application_Error(object sender, EventArgs e)
{
if (Request.HttpMethod == "POST")
{
var request = SomeMethodToReadRequestContentsInString();
var service = new SomeExceptionLoggingService();
var exception = Server.GetLastError();
if (exception == null)
{
exception = new ApplicationException("Unknown error occurred");
}
service.LogException(exception, Request.UserHostAddress, Request.UserAgent, request);
}
}
And to my surprise, nothing in the log file.
So then I decided to log ALL Post requests and see if I register ANYTHING in the log.
protected void Application_EndRequest(object sender, EventArgs e)
{
if (Request.HttpMethod == "POST")
{
var request = Helper.ReadStreamUnknownEncoding(Request.InputStream);
var service = new InterfaceTestingService();
var exception = Server.GetLastError();
if (exception == null)
{
exception = new ApplicationException("No Error in this request");
}
service.LogException(exception, Request.UserHostAddress, Request.UserAgent, request);
}
}
And again, nothing!
How do I catch this bug? My goal is to see the Content-Type, and contents.
I tried to add a Custom Field in IIS log settings to include `Content-Type', but the log files still don't have that.
I added a handler for Application_BeginRequest logging everything I did in Application_EndRequest. And it turns out, the content-length was zero, and there was no content. I also restarted IIS Web Server to get it to log custom fields too.
What's strange is that if I send empty content through Postman, I get the action code executed but for some reason when they do it, it doesn't.
I am currently integrating HockeyApp into my IOS project on Xamarin and I would like to be able to attach the username to the crash reports but I cant figure out how .Is it even possible ?
You can attach the username and other metadata to the report with the following sample:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
var manager = BITHockeyManager.SharedHockeyManager;
manager.Configure(AppID);
manager.UserEmail = "user#contoso.com";
manager.UserId = "UserID";
manager.UserName = "UserName";
manager.DebugLogEnabled = true;
manager.StartManager();
manager.Authenticator.AuthenticateInstallation(); // This line is obsolete in crash only builds
global::Xamarin.Forms.Forms.Init();
LoadApplication(CreateApp());
return base.FinishedLaunching(app, options);
}