小编Pat*_*son的帖子

Xamarin应用程序适用于模拟器但不适用于设备

我做了一个简单的应用程序,将一定数量的比特币转换为货币.

该应用程序在我的Android模拟器(Nexus 5x)上工作正常.我的问题是该应用程序抛出:

System.FormatException:输入字符串的格式不正确

当我在我的Android设备上测试它.我已经对我的模拟器和设备进行了调试,并且在参数方面没有差异.

有人有任何想法为什么会发生此异常?

stringRate参数

public static async Task<decimal> ConvertCurrency(string curr, decimal amount)
    {
        var currency = await GetCurrency(curr);
        var stringRate = currency.Rate;
        var rate = decimal.Parse(stringRate);//this is where the it crash
        var result = rate * amount;
        return result;
    }
Run Code Online (Sandbox Code Playgroud)

.net c# xamarin xamarin.forms

0
推荐指数
1
解决办法
445
查看次数

标签 统计

.net ×1

c# ×1

xamarin ×1

xamarin.forms ×1