【问题标题】:how to find systemexception in xamarin forms and the type or namespace name 'SystemException' could not be found in Xamarin.Forms (PCL)如何在 xamarin 表单中查找系统异常,并且在 Xamarin.Forms (PCL) 中找不到类型或命名空间名称“SystemException”
【发布时间】:2020-12-08 21:05:41
【问题描述】:

在 Xamarin.Forms (PCL) 中找不到类型或命名空间名称“SystemException”。它面向 .net 框架 4.5 和 ASP.NET Core 1.0。有没有其他方法可以在 xamarin.forms(PCL) 中找到系统异常。

【问题讨论】:

  • Exception 位于 System 命名空间中。如果您发布导致问题的实际代码会有所帮助
  • 我的解决方案对您有用吗?如果是,请您接受(点击此答案左上角的☑️),以便我们可以帮助更多有相同问题的人:)。

标签: xamarin exception xamarin.forms .net-4.5 portable-class-library


【解决方案1】:

Xamarin.forms 以 .NetStand 2.0.NetStand 2.1 为目标。我只是测试,你可以在这两个版本下使用System.SystemException

    try
    {

    }
    catch (Exception ex)
    {

        if (ex is System.SystemException)
        {

        }
    }

System.SystemException.net framework 4.5 中也可用,但在 .Net Core 1.0 中不可用。

您可以在this document 中查看它是否可用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-18
    • 2018-06-01
    • 1970-01-01
    • 2014-07-23
    • 2017-10-09
    • 1970-01-01
    相关资源
    最近更新 更多