Я получаю эту ошибку только при сборке релиза форм xamarin IOS.
App.xaml.cs
public partial class App : Application
{
public static MobileServiceClient MobileService = new MobileServiceClient(B2CConstants.ApplicationURL, new HttpClientHandler());
public static BaseViewModel BaseViewModel = new BaseViewModel();
public static ShapeTypeViewModel ShapeTypeViewModel = new ShapeTypeViewModel();
public static HoleDataViewModel HoleMapViewModel = new HoleDataViewModel();
public static PlayersViewModel PlayersViewModel = new PlayersViewModel();
public static RoundsViewModel RoundsViewModel = new RoundsViewModel();
public static ScoresViewModel ScoresViewModel = new ScoresViewModel();
public static TeeTimesViewModel TeeTimesViewModel = new TeeTimesViewModel();
public static TournamentViewModel TournamentSamplesViewModel = new TournamentViewModel();
public static ShapesViewModel ShapeViewModel = new ShapesViewModel();
public static MyTournamentsViewModel MyTournamentsViewModel = new MyTournamentsViewModel();
public static MyTournamentCoursesViewModel MyTournamentCoursesViewModel = new MyTournamentCoursesViewModel();
public static MyTournamentPlayersViewModel MyTournamentPlayersViewModel = new MyTournamentPlayersViewModel();
public static MyTournamentLeaderboardViewModel MyTournamentLeaderboardViewModel = new MyTournamentLeaderboardViewModel();
public static MyTournamentRoundsViewModel MyTournamentRoundsViewModel = new MyTournamentRoundsViewModel();
public static MyTournamentScoresViewModel MyTournamentScoresViewModel = new MyTournamentScoresViewModel();
public static MyTournamentYardagesViewModel MyTournamentYardagesViewModel = new MyTournamentYardagesViewModel();
Какая бы модель просмотра ни вызывалась первый (который вызывает azure мобильные службы) - вызывает ошибку.
ShapesViewModel.cs
public class ShapesViewModel : BaseViewModel
{
public MobileServiceCollection<GeoPosShapes, GeoPosShapes> shapeItems;
public IMobileServiceSyncTable<AzureShapes> ShapesTable = App.MobileService.GetSyncTable<AzureShapes>(); // offline sync
Ошибка возникает при вызове GetSyncTable (Tablename).
Shapes.cs
namespace RangeFinder.Models
{
public class AzureShapes
{
public string id { get; set; }
public int shapetypeid { get; set; }
public string courseid { get; set; }
[JsonProperty(PropertyName = "wkt")]
public string WKT { get; set; }
[JsonProperty(PropertyName = "hole")]
public int Hole { get; set; }
}
public class GeoPosShapes
{
public string id { get; set; }
public int shapetypeid { get; set; }
public string courseid { get; set; }
[JsonProperty(PropertyName = "hole")]
public int Hole { get; set; }
public List<Position> PolyGeoPos { get; set; }
//public MapElement mapElement { get; set; }
}
}
Сообщение об ошибке:
Поток 0x6 завершился с кодом 0 (0x0). 2020-06-18 22: 44: 36.650 RangeFinder.iOS [571: 98215] System.TypeInitializationException: инициализатор типа для RangeFinder.App вызвал исключение. ---> System.InvalidOperationException: элемент id не найден для типа RangeFinder.Models.ShapeTypes. в Microsoft. WindowsAzure .MobileServices.MobileServiceContractResolver.DetermineIdProperty (тип System.Type, свойства System.Collections.Generi c .IEnumerable`1 [T]) [0x00070] в: 0 в Microsoft. Windows Azure .MobileServices.MobileServiceContractResolver.CreatePropertiesInner (тип System.Type, Newtonsoft. Json .MemberSerialization memberSerialization) [0x00075] в: 0 в Microsoft. WindowsAzure .MractobileServices.MobileesPropervice.Тип , Newtonsoft. Json .MemberSerialization memberSerialization) [0x0004f] в: 0 в Newtonsoft. Json .Serialization.DefaultContractResolver.CreateObjectContract (System.Type objectType) [0x0003a] в <2073514815234917a] в <2073514815234917a 1 045 * .MobileServices.MobileServiceContractResolver.CreateObjectContract (System.Type ObjectType) [0x00000] в:. 0 при Newtonsoft * 1 047 * .Serialization.DefaultContractResolver.CreateContract (System.Type ObjectType) [0x0010f] в <2073514815234917a5e8f91b0b239405>: 0 в Micr osoft. WindowsAzure .MobileServices.MobileServiceContractResolver.ResolveTableName (тип System.Type) [0x000ea] в: 0 в Microsoft. WindowsAzure .MobileServices.MobileServiceClient.GetSyncTable [T] () : 0 в RangeFinder.ViewModels.ShapeTypeViewModel..ctor () [0x00000] в C: \ Users \ Karl \ Source \ Repos \ RangeFinder \ RangeFinder.standard \ ViewModels \ ShapeTypeViewModel.cs: 13 в RangeFinder.App..cctor () [0x00027] в C: \ Users \ Karl \ Source \ Repos \ RangeFinder \ RangeFinder.standard \ Views \ App.xaml.cs: 36 --- Конец внутренней трассировки стека исключений --- в RangeFinder. iOS .AppDelegate .FinishedLaunching (приложение UIKit.UIApplication, параметры Foundation.NSDictionary) [0x00093] в <92430b17376a435287b491877f96ca89>: 0 в (оболочка, управляемая в родную) UIKit.UIApplication.UIApplication, intr, intr, intr ) в UIKit.UIApplication.Main (System.String [] args, участник System.IntPtr, делегат System.IntPtr) [0x00005] в /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/ Xamarin.i OS / UIKit / UIApplication.cs: 86 в UIKit.UIApplication.Main (System.String [] args, System.String PrincipalClassName, System.String delegateClassName) [0x0000e] в /Library/Frameworks/Xamarin.iOS.framework/ Версии / 13.18.2.1 / src / Xamarin.iOS / UIKit / UIApplication.cs: 65 в RangeFinder. iOS .Application.Main (System.String [] args) [0x00000] в <92430b17376a435287b491877f96ca89>: 0 System .TypeInitializationException: 'Loading ...'
Любая помощь будет принята с благодарностью - поскольку это последний шаг перед публикацией приложения в IOS AppStore