ygrenier / SwissEphNet

Swiss Ephemeris for .Net. A Swiss Ephemeris portage for .Net.
Other
77 stars 35 forks source link

System.TypeInitializationException when running on iPhone simulator #14

Closed sundraw closed 8 years ago

sundraw commented 8 years ago

The exception occurred when running a Xamarin.Forms app on iOS (both simulator and device). The same code runs just fine on an Android emulator.

Here is the stack trace. It looks like the reason for the problem is the use of 1252 encoding.

System.TypeInitializationException: The type initializer for 'SwissEphNet.SwissEph' threw an exception. ---> System.NotSupportedException: No data is available for encoding 1252. at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00214] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/text/encoding.cs:520 at System.Text.Encoding.GetEncoding (System.String name) [0x00000] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/text/encoding.cs:653 at SwissEphNet.SwissEph..cctor () [0x00000] in :0 --- End of inner exception stack trace --- at SwissEphTest.MainPage.OnCalculate (System.Object sender, System.EventArgs args) [0x00001] in /Users/Sundraw/Projects/SwissEphTest/SwissEphTest/MainPage.xaml.cs:19 at Xamarin.Forms.Button.Xamarin.Forms.IButtonController.SendClicked () [0x00020] in :0 at Xamarin.Forms.Platform.iOS.ButtonRenderer.OnButtonTouchUpInside (System.Object sender, System.EventArgs eventArgs) [0x0000e] in :0 at UIKit.UIControlEventProxy.Activated () [0x00007] in /Users/builder/data/lanes/2377/73229919/source/maccore/src/UIKit/UIControl.cs:37 at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2377/73229919/source/maccore/src/UIKit/UIApplication.cs:77 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/2377/73229919/source/maccore/src/UIKit/UIApplication.cs:61 at SwissEphTest.iOS.Application.Main (System.String[] args) [0x00008] in /Users/Sundraw/Projects/SwissEphTest/iOS/Main.cs:17

ygrenier commented 8 years ago

I just find this : http://developer.xamarin.com/guides/ios/advanced_topics/localization_and_internationalization/encodings/

Did you activate the "west" extra encoding ?

sundraw commented 8 years ago

Wonderful! Now it works.

ygrenier commented 8 years ago

Good news.

ygrenier commented 8 years ago

Add FAQ wiki page for information : https://github.com/ygrenier/SwissEphNet/wiki/FAQ