Realms.SynchronizationContextEventLoop error in realm - xamarin

when we are trying update realm db multiple times its throwing following error
NHANDLED EXCEPTION:
System.ObjectDisposedException: Safe handle has been closed
at (wrapper managed-to-native) System.Object:wrapper_native_0xda0c96a0 (intptr)
at Realms.SynchronizationContextEventLoopSignal+EventLoop+<Post>c__AnonStorey0.<>m__0 (System.Object _) [0x00012] in <550621f4184f47c0bdfce087c391c293>:0
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <d855bac285f44dda8a0d8510b679b1e2>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0
at (wrapper dynamic-method) System.Object:f9edc18f-c720-423d-8576-23c20d8f6a89 (intptr,intptr)
we have tried to keep our code inside try and catch but its still throwing runtime error and application gets crashed
Code , here EventType is a normal class ( not derived from RealmObject ) but Response class is a RealmObject and it has opportunitiesList declared as
public IList<Opportunity> opportunitiesList { get; } and its derived from RealmObject
private void updateGetData(EventType e)
{
try
{
Realm realm = Realm.GetInstance();
realm.WriteAsync(tempRealm =>
{
if (Settings.IsSingleOpportunityUpdated == false)
{
tempRealm.Add(e.response, true);
}
else if (Settings.IsSingleOpportunityUpdated)
{
if (e.response != null && e.response.opportunitiesList.Count > 0)
{
long opportunityId = e.response.opportunitiesList[0].opportunityId;
var opportunity = tempRealm.All<Opportunity>().FirstOrDefault(d => d.opportunityId == opportunityId);
e.response.opportunitiesList[0].isOpportunitySync = 0;
e.response.opportunitiesList[0].isSync = SyncStatus.SYNCED;
e.response.opportunitiesList[0].mOpportunityId = opportunity.mOpportunityId;
Debug.WriteLine("Opportunity Id after getOpportunity " + opportunity.opportunityId + " " + opportunityId + " " + e.response.opportunitiesList[0].isSync);
tempRealm.Add(e.response.opportunitiesList[0], true);
}
else
{
Debug.WriteLine("RealmDB opportunity response is empty " + Settings.IsSingleOpportunityUpdated);
}
}
});
}
catch(Exception exception)
{
Debug.WriteLine("RealmDB " + exception.StackTrace);
}
}

Related

await CrossFilePicker.Current.PickFile() not working for pdf files

I am using await CrossFilePicker.Current.PickFile() for file picking in xamarin forms but it is not working for pdf files, I am getting the exception below:
Exception :
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0008e] in <24e422c426e0468ca1fd74b59870ff08>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001f] in <24e422c426e0468ca1fd74b59870ff08>:0
at Android.Content.ContentResolver.Query (Android.Net.Uri uri, System.String[] projection, System.String selection, System.String[] selectionArgs, System.String sortOrder) [0x000a0] in /Users/builder/azdo/_work/278/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-28/mcw/Android.Content.ContentResolver.cs:1096
at Plugin.FilePicker.IOUtil.GetDataColumn (Android.Content.Context context, Android.Net.Uri uri, System.String selection, System.String[] selectionArgs) [0x00013] in D:\a\1\s\src\Plugin.FilePicker\Android\IOUtil.android.cs:154
at Plugin.FilePicker.IOUtil.GetPath (Android.Content.Context context, Android.Net.Uri uri) [0x0017d] in D:\a\1\s\src\Plugin.FilePicker\Android\IOUtil.android.cs:111
at Plugin.FilePicker.FilePickerActivity.OnActivityResult (System.Int32 requestCode, Android.App.Result resultCode, Android.Content.Intent data) [0x00054] in D:\a\1\s\src\Plugin.FilePicker\Android\FilePickerActivity.android.cs:168
How can I resolve this?
As Jason said, you could use the Xamarin.Essentials. The code below to pick pdf files for your reference.
async Task<FileResult> PickAndShow(PickOptions options)
{
try
{
var result = await FilePicker.PickAsync(options);
if (result != null)
{
Text = $"File Name: {result.FileName}";
if (result.FileName.EndsWith("pdf", StringComparison.OrdinalIgnoreCase))
{
//do something you want
}
}
return result;
}
catch (Exception ex)
{
// The user canceled or something went wrong
}
return null;
}

Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown ? in Xamarin.Forms

i wanna use simple database in Xamarin Forms. So i used this code;
public partial class DBExample : ContentPage
{
string _dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),"myDB.db3");
public DBExample ()
{
InitializeComponent ();
}
private async void InsertButton(object sender, EventArgs e)
{
SQLiteConnection db=null;
try
{
db = new SQLiteConnection(_dbPath);
}
catch (Exception ex)
{
await DisplayAlert(null, ex.Message, "OK");
}
db.CreateTable<Users>();
var maxPk = db.Table<Users>().OrderByDescending(c => c.Id).FirstOrDefault();
Users users = new Users()
{
Id = (maxPk == null ? 1 : maxPk.Id + 1),
Name = userName.Text
};
db.Insert(users);
await DisplayAlert(null,userName.Text + "saved","OK");
await Navigation.PopAsync();
}
}
and i have problem. You can see it in Headtitle.
"Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown"
im waiting your support. Thanks for feedback.

Background Job Fails with "Current user did not login to the application"

using MVC jQuery .NET Core
using Abp Background Job
I have a background job that get Enqueued correctly and I can see the job in the db.
However the logging shows me I'm getting and authorization error (ee below) despite being logged in. I have the same AbpAuthorize attributes placed on the services and background jobs.
Not sure how to proceed debugging the problem - any suggestions welcome.
SERVICE CODE USING/ENQUEUING THE JOB:
public async Task BulkImportBackground(IList<CreatePracticeDto> inputs)
{
await _backgroundJobManager.EnqueueAsync<ImportBulkPracticesBackgroundJob, ImportBulkPracticesBackgroundJobArgs>(
new ImportBulkPracticesBackgroundJobArgs
{
CreatePracticeDtos = inputs
});
_backgroundJobManager.Start();
}
JOB CLASS CODE:
using Abp.Authorization;
using Abp.BackgroundJobs;
using Abp.Dependency;
using Abp.Modules;
using Gp.Authorization;
using Gp.Ccre.ImportResult;
using Gp.Ccre.ImportResult.Dtos;
using Gp.Ccre.Practice.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using Abp.Domain.Uow;
namespace Gp.Ccre.Practice.BackgroundJobs
{
[DependsOn(
typeof(IPracticeAppService),
typeof(IImportResultsAppService))]
[AbpAuthorize(PermissionNames.Pages_Practices, RequireAllPermissions = false)]
public class ImportBulkPracticesBackgroundJob : BackgroundJob<ImportBulkPracticesBackgroundJobArgs>, ITransientDependency
{
private readonly IPracticeAppService _practiceAppService;
private readonly IImportResultsAppService _importResultsAppService;
public ImportBulkPracticesBackgroundJob(IImportResultsAppService importResultsAppService, IPracticeAppService practiceAppService)
{
_practiceAppService = practiceAppService;
_importResultsAppService = importResultsAppService;
}
public override void Execute(ImportBulkPracticesBackgroundJobArgs args)
{
IList<CreateImportResultDto> createResultsDto = new List<CreateImportResultDto>();
var k = 0;
DateTime importedOn = DateTime.Now;
foreach (CreatePracticeDto createDto in args.CreatePracticeDtos)
{
k++;
try
{
//this correctly automatically ignores 'soft' deleted records.
var count = _practiceAppService.GetAllIdName().Result.Count(x => x.Name.Equals(createDto.Name, StringComparison.CurrentCultureIgnoreCase));
if (count > 0)
{
createResultsDto.Add(new CreateImportResultDto
{
Row = k,
Name = createDto.Name,
Message = "Already exists. Skipped.",
MessageType = AppConsts.ImportMessageType.Warning.ToString(),
ImportedOn = importedOn
});
continue;
}
// ** GOOGLE MAP API CALL **
var coordinatesFound = false; //_practiceAppService.TryGetGeoCodeAddress(createDto);
createDto.ImportedOn = importedOn;
// *** SAVE SINGLE ****
_practiceAppService.Create(createDto);
createResultsDto.Add(new CreateImportResultDto
{
Row = k,
Name = createDto.Name,
Message = "Successful.",
MessageType = AppConsts.ImportMessageType.Info.ToString(),
ImportedOn = importedOn,
GoogleMapCoordinatesFound = coordinatesFound
});
}
catch (Exception e)
{
createResultsDto.Add(new CreateImportResultDto
{
Row = k,
Name = createDto.Name,
Message = e.Message,
MessageType = AppConsts.ImportMessageType.Error.ToString(),
ImportedOn = importedOn
});
continue;
}
}
//*** SAVE RESULTS ***
foreach (var resultDto in createResultsDto)
{
_importResultsAppService.Create(resultDto);
}
CurrentUnitOfWork.SaveChanges();
}
}
[Serializable]
public class ImportBulkPracticesBackgroundJobArgs
{
public IList<CreatePracticeDto> CreatePracticeDtos { get; set; }
}
}
STACK TRACE (partial)
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(IEnumerable`1 authorizeAttributes) in D:\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 43
at Abp.Authorization.AuthorizationHelper.CheckPermissions(MethodInfo methodInfo, Type type) in D:\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 98
at Abp.Authorization.AuthorizationHelper.AuthorizeAsync(MethodInfo methodInfo, Type type) in D:\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationHelper.cs:line 57
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
at Abp.Authorization.AuthorizationInterceptor.Intercept(IInvocation invocation) in D:\Github\aspnetboilerplate\src\Abp\Authorization\AuthorizationInterceptor.cs:line 20
at Castle.DynamicProxy.AbstractInvocation.Proceed()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Abp.BackgroundJobs.BackgroundJobManager.TryProcessJob(BackgroundJobInfo jobInfo) in D:\Github\aspnetboilerplate\src\Abp\BackgroundJobs\BackgroundJobManager.cs:line 119
The problem was caused by trying to inject a service into the background job. stick to IRepository and all good.

Xamarin Forms InAppBillingPlugin PurchaseAsync exeption

I need some support regarding InAppBillingPlugin for Xamarin.Forms. First of all I did configuration according to documnetation: https://jamesmontemagno.github.io/InAppBillingPlugin/
application, Google Console (managed products) and iTunes Connect site.
Here is my application code.
private async Task TryInAppPurchace(string androidProductId, string iOSProductId="")
{
if (!CrossInAppBilling.IsSupported)
return;
//Android
var products = new string[] { androidProductId };
if(Device.RuntimePlatform == Device.iOS)
products = new string[] { iOSProductId };
var billing = CrossInAppBilling.Current;
//billing.InTestingMode = true;
try
{
var connected = await billing.ConnectAsync(ItemType.InAppPurchase);
if (!connected)
{
await Application.Current.MainPage.DisplayAlert("Connectivity Error", "Unable to connect to the internet.", "OK");
return;
}
var items = await billing.GetProductInfoAsync(ItemType.InAppPurchase, products);
var item = items.ToList().First();
//try to purchase item
var purchase = await billing.PurchaseAsync(item.ProductId, ItemType.InAppPurchase, item.ProductId);
//possibility that a null came through.
if (purchase == null)
{
await Application.Current.MainPage.DisplayAlert("Purchase Error", "You are unable to buy this product.", "OK");
return;
}
else
{
await _pageService.DisplayAlert("Purchased", "Consumable product.", "OK");
if (Device.RuntimePlatform == Device.iOS)
return;
var consumedItem = await CrossInAppBilling.Current.ConsumePurchaseAsync(purchase.ProductId, purchase.PurchaseToken);
if (consumedItem != null)
{
await Application.Current.MainPage.DisplayAlert("New Package added", "Successfully added new package", "OK");
}
}
}
catch (InAppBillingPurchaseException purchaseEx)
{
var message = string.Empty;
await Application.Current.MainPage.DisplayAlert("Exeption", purchaseEx.Message, "OK");
switch (purchaseEx.PurchaseError)
{
case PurchaseError.BillingUnavailable:
message = "BillingUnavailable";
break;
case PurchaseError.DeveloperError:
message = "DeveloperError";
break;
case PurchaseError.ItemUnavailable:
message = "ItemUnavailable";
break;
case PurchaseError.GeneralError:
message = "GeneralError";
break;
case PurchaseError.UserCancelled:
message = "UserCancelled.";
break;
case PurchaseError.AppStoreUnavailable:
message = "AppStoreUnavailable.";
break;
case PurchaseError.PaymentNotAllowed:
message = "PaymentNotAllowed.";
break;
case PurchaseError.PaymentInvalid:
message = "PaymentInvalid";
break;
case PurchaseError.InvalidProduct:
message = "InvalidProduct";
break;
case PurchaseError.ProductRequestFailed:
message = "ProductRequestFailed";
break;
case PurchaseError.RestoreFailed:
message = "RestoreFailed";
break;
case PurchaseError.ServiceUnavailable:
message = "ServiceUnavailable";
break;
}
}
catch (Exception ex)
{
//Something else has gone wrong, log it
await Application.Current.MainPage.DisplayAlert("Exeption", ex.Message, "OK");
}
finally
{
await billing.DisconnectAsync();
}
}
My problem is that I am not able to buy the same product again and I am getting exeption from Google Play:
{Plugin.InAppBilling.Abstractions.InAppBillingPurchaseException:
Unable to process purchase. at
Plugin.InAppBilling.InAppBillingImplementation+d__33.MoveNext
() [0x00116] in
C:\projects\inappbillingplugin\src\Plugin.InAppBilling.Android\InAppBillingImplementation.cs:324
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in :0 at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
(System.Threading.Tasks.Task task) [0x0003e] in
:0 at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
(System.Threading.Tasks.Task task) [0x00028] in
:0 at
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
(System.Threading.Tasks.Task task) [0x00008] in
:0 at
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult ()
[0x00000] in :0 at
Plugin.InAppBilling.InAppBillingImplementation+d__32.MoveNext
() [0x00090] in
C:\projects\inappbillingplugin\src\Plugin.InAppBilling.Android\InAppBillingImplementation.cs:264
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000c] in :0 at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess
(System.Threading.Tasks.Task task) [0x0003e] in
:0 at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
(System.Threading.Tasks.Task task) [0x00028] in
:0 at
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd
(System.Threading.Tasks.Task task) [0x00008] in
:0 at
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult ()
[0x00000] in :0 at
DrivingCourse_app.ViewModels.AccessPageViewModel+d__18.MoveNext
() [0x0025c] in
C:\Projects\GIT-REPO\DrivingCourse_DE\DrivingCourse_app\DrivingCourse_app\DrivingCourse_app\ViewModels\AccessPageViewModel.cs:136
}
Is something wrong with my code? This code is working for every fist purchase of the product, so configuration itself and the general process works.
Any ideas?

NullReference when ShowViewModel is called for MvxTabBarViewController

I created a MvxTabBarViewController and when I'm trying open that using ShowViewModel method, a NullReferenceException occurs. The ViewModel property is always null and the exception occurs if I try instanciate that.
There is my MvxTabViewController
[Register("ProjectDetailsView")]
public class ProjectDetailsView : MvxTabBarViewController<ProjectDetailsViewModel>
{
private JVMenuPopoverViewController _menuController;
public override void ViewDidLoad()
{
base.ViewDidLoad();
if (ViewModel == null)
{
ViewModel = new ProjectDetailsViewModel();
}
CriaAbas();
CriaMenu();
}
private void CriaMenu()
{
var itensMenu = new List<JVMenuItem>();
var selectFavoriteProjectsItem = new JVMenuActionItem
{
Title = "Select Favorite Projects",
Command = () =>
{
var favoriteProjectsView = this.CreateViewControllerFor<FavoriteProjectsViewModel>() as UIViewController;
NavigationController.PushViewController(favoriteProjectsView, true);
}
};
itensMenu.Add(selectFavoriteProjectsItem);
var logoutItem = new JVMenuActionItem()
{
Title = "Logout",
Command = ViewModel.LogoutCommand.Execute
};
itensMenu.Add(logoutItem);
_menuController = new JVMenuPopoverViewController(itensMenu);
var menuButton = new UIBarButtonItem();
menuButton.Clicked += (sender, args) =>
{
_menuController.ShowMenuFromController(this);
};
menuButton.Image = UIImage.FromBundle("images/ic_menu_white_36pt.png");
NavigationItem.RightBarButtonItem = menuButton;
}
private void CriaAbas()
{
var abas = new List<UIViewController>();
var controller = new UINavigationController();
var informationView = this.CreateViewControllerFor(ViewModel.ProjectInformationViewModel) as UIViewController;
informationView.TabBarItem = new UITabBarItem("Information", UIImage.FromBundle("images/ic_info_outline.png"), 0);
informationView.Title = "Information";
controller.PushViewController(informationView, false);
abas.Add(informationView);
controller = new UINavigationController();
var milestonesView = this.CreateViewControllerFor(ViewModel.ProjectMilestonesViewModel) as UIViewController;
milestonesView.TabBarItem = new UITabBarItem("Milestones", UIImage.FromBundle("images/ic_assistant_photo_48pt.png"), 0);
milestonesView.Title = "Milestones";
controller.PushViewController(milestonesView, false);
abas.Add(milestonesView);
ViewControllers = abas.ToArray();
SelectedViewController = ViewControllers[0];
}
}
I'm trying to open this view calling ShowViewModel();
What I'm doing wrong?
there is a part of my stack trace:
mvx: Diagnostic: 72,18 Showing ViewModel ProjectDetailsViewModel
iOSNavigation: Diagnostic: 72,18 Navigate requested
Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at MvvmCross.iOS.Views.MvxTabBarViewController.set_DataContext (System.Object value) [0x00001] in C:\vcs\git\MvvmCross\MvvmCross\iOS\iOS\Views\MvxTabBarViewController.cs:38
at MvvmCross.iOS.Views.MvxTabBarViewController.set_ViewModel (IMvxViewModel value) [0x00001] in C:\vcs\git\MvvmCross\MvvmCross\iOS\iOS\Views\MvxTabBarViewController.cs:44
at MvvmCross.iOS.Views.MvxTabBarViewController`1[TViewModel].set_ViewModel (MvvmCross.iOS.Views.TViewModel value) [0x00001] in C:\vcs\git\MvvmCross\MvvmCross\iOS\iOS\Views\MvxTabBarViewController.cs:68
at PROSPERI_EPMFast.iOS.Views.ProjectDetailsView.ViewDidLoad () [0x00016] in C:\Projetos Vinicius\PROSPERI_EPMFast\PROSPERI_EPMFast.iOS\Views\ProjectDetailsView.cs:22
at (wrapper managed-to-native) ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
at UIKit.UITabBarController..ctor () [0x0003b] in /Users/builder/data/lanes/3412/3cf8aaed/source/maccore/src/build/ios/native/UIKit/UITabBarController.g.cs:54
at MvvmCross.Platform.iOS.Views.MvxEventSourceTabBarController..ctor () [0x00000] in C:\vcs\git\MvvmCross\MvvmCross\Platform\iOS\Views\MvxEventSourceTabBarController.cs:20
at MvvmCross.iOS.Views.MvxTabBarViewController..ctor () [0x00000] in C:\vcs\git\MvvmCross\MvvmCross\iOS\iOS\Views\MvxTabBarViewController.cs:20
at MvvmCross.iOS.Views.MvxTabBarViewController`1[TViewModel]..ctor () [0x00000] in C:\vcs\git\MvvmCross\MvvmCross\iOS\iOS\Views\MvxTabBarViewController.cs:56
at PROSPERI_EPMFast.iOS.Views.ProjectDetailsView..ctor () <0x1b486900 + 0x0002b> in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /Users/builder/data/lanes/3412/3cf8aaed/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:644
For the sake of completion: https://stackoverflow.com/a/30283563/6143949
I'm guessing here the problem here will be specific to the way that
TabBarViewController is constructed.
ViewDidLoad is a virtual method and it is called the first time the
View is accessed.
In the case of TabBarViewController this happens during the iOS base
View constructor - i.e. it occurs before the class itself has had its
constructor called.
The only way around this I've found is to add a check against the
situation in ViewDidLoad, and to make a second call to ViewDidLoad
during the class constructor.
You can see this in action N-25 -
https://github.com/MvvmCross/NPlus1DaysOfMvvmCross/blob/976ede3aafd3a7c6e06717ee48a9a45f08eedcd0/N-25-Tabbed/Tabbed.Touch/Views/FirstView.cs#L17
Something like:
public class MainView : MvxTabBarViewController
{
private bool _constructed;
public MainView()
{
_constructed = true;
// need this additional call to ViewDidLoad because UIkit creates the view before the C# hierarchy has been constructed
ViewDidLoad();
}
public override void ViewDidLoad()
{
if (!_constructed)
return;
base.ViewDidLoad();
var vm = (MainViewModel)this.ViewModel;
if (vm == null)
return;
}
}
Solution provided by Stuart (https://stackoverflow.com/users/373321/stuart)

Resources