Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit c57ff14

Browse files
committed
Do not try find assemblies in WindowStore apps
1 parent 53777c8 commit c57ff14

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

src/ServiceStack.Text/Env.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,25 @@ static Env()
1414
throw new ArgumentException("PclExport.Instance needs to be initialized");
1515

1616
var platformName = PclExport.Instance.PlatformName;
17+
if (platformName != "WindowsStore")
18+
{
19+
IsMono = AssemblyUtils.FindType("Mono.Runtime") != null;
1720

18-
IsMono = AssemblyUtils.FindType("Mono.Runtime") != null;
19-
20-
IsMonoTouch = AssemblyUtils.FindType("MonoTouch.Foundation.NSObject") != null;
21+
IsMonoTouch = AssemblyUtils.FindType("MonoTouch.Foundation.NSObject") != null;
2122

22-
IsAndroid = AssemblyUtils.FindType("Android.Manifest") != null;
23+
IsAndroid = AssemblyUtils.FindType("Android.Manifest") != null;
2324

24-
IsWinRT = AssemblyUtils.FindType("Windows.ApplicationModel") != null;
25+
//Throws unhandled exception if not called from the main thread
26+
//IsWinRT = AssemblyUtils.FindType("Windows.ApplicationModel") != null;
2527

26-
IsWindowsPhone = AssemblyUtils.FindType("Microsoft.Phone.Info.DeviceStatus") != null;
28+
IsWindowsPhone = AssemblyUtils.FindType("Microsoft.Phone.Info.DeviceStatus") != null;
2729

28-
IsSilverlight = AssemblyUtils.FindType("System.Windows.Interop.SilverlightHost") != null;
30+
IsSilverlight = AssemblyUtils.FindType("System.Windows.Interop.SilverlightHost") != null;
31+
}
32+
else
33+
{
34+
IsWinRT = true;
35+
}
2936

3037
#if PCL
3138
IsUnix = IsMono;

src/ServiceStack.Text/PclExport.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ namespace ServiceStack
2020
{
2121
public abstract class PclExport
2222
{
23+
public const string WindowsStore = "WindowsStore";
24+
public const string Android = "Android";
25+
public const string IOS = "IOS";
26+
public const string WindowsStore = "WindowsStore";
27+
public const string Silverlight5 = "Silverlight5";
28+
2329
public static PclExport Instance
2430
#if PCL
2531
/*attempts to be inferred otherwise needs to be set explicitly by host project*/

0 commit comments

Comments
 (0)