Xamarin.Forms app works in debug but crash in release on ios - ios

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

Related

xamarin.forms application not running on ios simulator

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);
}
}
}

Crashlytics WriteZStream stacktrace

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?

.Net Quartz Scheduler 2.3 does not work on the remote server

I am working on a windows service that works on my development machine, but when I deploy to a test server I find that the Quartz Scheduler I have set up does not work.
There are no exceptions thrown or any clues as to why this is.
Here is my code;
protected override void OnStart(string[] args)
{
try
{
this.SetDailySchedule();
}
catch (SchedulerException ex)
{
this.eventLog.WriteEntry("WMS FM Loader: Schedule Error - " + ex.Message);
throw ex;
}
catch (Exception ex)
{
this.eventLog.WriteEntry("WMS FM Loader: Unexpected Error - " + ex.Message);
throw ex;
}
}
private void SetDailySchedule()
{
this.eventLog.WriteEntry("On Start".Log());
var schedule = this.GetSchedule();
try
{
this.schedFact = new StdSchedulerFactory();
this.sched = this.schedFact.GetScheduler();
}
catch (Exception ex)
{
this.eventLog.WriteEntry(ex.Message.Log());
throw;
}
this.eventLog.WriteEntry(string.Format("Got a scheduler: {0}", schedule).Log());
try
{
ScheduleTheLoad(schedule);
}
catch (Exception ex)
{
this.eventLog.WriteEntry(ex.Message.Log());
throw;
}
this.eventLog.WriteEntry("WMS FM Loader: Scheduler ready");
}
private void ScheduleTheLoad(string schedule)
{
var job = JobBuilder.Create<LoadWorksOrders>().WithIdentity("LoadWorksOrdersJob").Build();
// Trigger the job to run now, and then every day
var trigger =
TriggerBuilder.Create()
.ForJob(job)
.WithIdentity("LoadWorksOrdersTrigger")
.StartNow()
.WithCronSchedule(schedule)
.Build();
this.sched.ScheduleJob(job, trigger);
this.sched.Start();
}
I manually start the service and the event log shows that the scheduler is ready, but LoadWorksOrdersJob doe snot get run.
How should I fix this?
Are you running the two methods in the windows service OnStart? Are you using a service account? Any exceptions in the event viewer/ have you started /stopped the service from services.msc?
I also had this problem. It took me a day to work it out.
For me it was that my assembly had dots/periods in its name. e.g.
Project.UpdateService
When I changed it to...
ProjectUpdateService
... it worked fine. It always worked on the development machine. It just would not work on the remote machine.
UPDATE: It may have been the length of the service that has caused this issue. By removing the dots I shortened the service name. It looks like the maximum length is 25 characters.

message queue full error in blackberry

I have coded to get the info from the user and send an email of clicking a button. The program is getting executed for a while and then the simulator is crashing showing error
"DE427"-Message queue full... Here's the code that i have done...
if(field==SendMail)
{
Message m = new Message();
Address a = null;
try {
a = new Address("user#xyz.com", "Rahul");
} catch (AddressException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Address[] addresses = {a};
try {
m.addRecipients(net.rim.blackberry.api.mail.Message.RecipientType.TO, addresses);
m.setContent("Name:"+Name.getText().toString()+"\n"+ "Phone :"+Phone.getText().toString()+
"\n"+ "Date & Time:"+DateShow.getText().toString()+"\n"+"Make:"+Make.getText().toString()+
"\n"+"Model:"+Model.getText().toString()+"\n"+"Miles:"+Miles.getText().toString()+"\n");
m.setSubject("Appointment Request (Via Blackberry app)");
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));
}
Can anyone tell me what the error is and how to rectify the problem....Plz...
It seems there is an issue with certain versions of Windows XP and the Blackberry simulator version. Check this link http://supportforums.blackberry.com/t5/Testing-and-Deployment/Simulator-quot-device-Error-DE427-quot/m-p/556321
If you clean up the simulator (delete .dmp files from simulator directory) and restart the simulator it works fine

UDP Send Error on BlackBerry

I am writing network application for Blackberry. This code is correct on the simulator but not working on a device. When I run my application on the simulator, my server recieves the message but when I run it on a device, I get an Exception, not IOException, with message "NULL".
try {
byte[] b = msg.getBytes();
dc = (UDPDatagramConnection)Connector.open("datagram://"+getHIP()+":" + getHPort());
Datagram dobject = dc.newDatagram(b, b.length);
dc.send(dobject);
System.out.println("Addr:" + dobject.getAddress());
System.out.println("Well Done!");
} catch (IOException e) {
System.out.println(e.getMessage());
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
if (dc != null) {
try {
dc.close();
} catch (Exception f) {
System.out.println("Failed to close Connector: " + f);
}
}
}
Network access on the BlackBerry is far from seemless from a developer's point of view. You either have to specify how the connection should be made in the URL, or the device has to have the correct APN settings in Options > Advanced Options > TCP Settings. You could try finding those and entering them to see if it works.
UDP requires the APN to be set in the Connector.open():
(DatagramConnection) Connector.open("udp://<host>:<dest_port>[;<src_port>]/<apn>[|<type>][;tunnelauthusername=<apn username>;tunnelauthpassword=<apn password>]");
For more info on that check out the Connector
It works fine on the simulator w/o APN because the simulator doesn't have an APN, but you need on a real device.
I can think of two possibilities:
UDP is optional in the J2ME spec - so maybe the Blackberry doesn't support it.
The network the device is on might not support it, and the device can detect this, and reports it with an exception.

Resources