【问题标题】:System.PlatformNotSupportedException when making calls from iPhone client从 iPhone 客户端拨打电话时出现 System.PlatformNotSupportedException
【发布时间】:2013-07-25 04:38:00
【问题描述】:

我正在尝试使用 MonoTouch 在 Visual Studio 2012 下运行 Tasks。我正在使用 ALPHA 频道并安装了最新版本。

解决方案中有 3 个项目: 1. 带有异步方法的 PCL(158 个目标平台) 2. 触摸 3.安卓

此代码可以编译,可以部署和执行。但是当我从 iPhone 客户端拨打电话时:

var asyncResult = await MyClass.DoStuff();
Console.WriteLine("doing stuff completed: " + asyncResult);

我得到以下结果:

System.PlatformNotSupportedException:不支持此平台

在等待部分代码。当我用Task.ContinueWith 编写它时 - 结果相同。

有趣的是不仅仅在 Visual Studio + MonoTouch 下工作。所有其他配置正确启动此代码(WIN+VS+Android、WIN+VS+Android、MAC+XS+iOS、MAC+XS+Android)

SDK 版本与最新的 ALPHA 版本同步。

异常详情: 未处理的异常:

System.PlatformNotSupportedException: This platform is not supported.
2013-07-25 11:45:32.384 iPhone[1817:907] Unhandled managed exception: This platform is not supported. (System.PlatformNotSupportedException)
  at System.ExecutionContextLightup.Run (System.ExecutionContextLightup executionContext, System.Action`1 callback, System.Object state) [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <filename unknown>:0 
  at Microsoft.Runtime.CompilerServices.TaskAwaiter+<>c__DisplayClassa.<OnCompletedInternal>b__1 (System.Object state) [0x00000] in <filename unknown>:0 
  at MonoTouch.UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey52.<>m__4E () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIKitSynchronizationContext.cs:24 
  at MonoTouch.Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSAction.cs:87 
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at
 MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 
  at iPhone.Application.Main (System.String[] args) [0x00001] in c:\Sources\Local\PCL_XN\iPhone\Main.cs:17 
The program 'Mono' has exited with code 0 (0x0).
The program '[6760] iPhone.vshost.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).

【问题讨论】:

  • 您能发布异常的完整堆栈跟踪吗?
  • @svick 刚刚做到了。谢谢!

标签: visual-studio xamarin xamarin.ios task-parallel-library portable-class-library


【解决方案1】:

回复有点晚,但如果有人仍然遇到这个问题,看起来一种解决方法是在主应用程序项目的“项目选项 - > iOS 构建 - > 附加 mtouch 参数”下添加 --nolinkaway --linkskip=mscorlib .

如果没有这个,链接器会从 mscorlib 中删除 Microsoft.Bcl 包进行兼容性检查所需的内容。

在此处提交的错误:https://bugzilla.xamarin.com/show_bug.cgi?id=15290

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-08
    • 1970-01-01
    • 2014-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多