在将Appcenter与Xamarin一起使用时,是否有方法避免截断附加属性?

在将Appcenter与Xamarin一起使用时,是否有方法避免截断附加属性?,xamarin,xamarin.forms,Xamarin,Xamarin.forms,这是我的密码: Crashes.TrackError(ex, new Dictionary<string, string> { {"RunQuery", "Exception"}, {"sql", s }, {"Device Model", DeviceInfo.Model }, {"Exception", ex.ToString()} }); 崩溃。

这是我的密码:

    Crashes.TrackError(ex,
       new Dictionary<string, string> {
            {"RunQuery", "Exception"},
            {"sql", s },
            {"Device Model", DeviceInfo.Model },
            {"Exception", ex.ToString()}
       });
崩溃。跟踪错误(例如,
新词典{
{“RunQuery”,“Exception”},
{“sql”,s},
{“设备模型”,DeviceInfo.Model},
{“异常”,例如ToString()}
});
一切正常,但我发现Appcenter将参数的长度限制为125个字符,因此对我来说毫无用处,因为我永远看不到所有的sql或ex字符串


有人找到了解决这个问题的方法吗?

我也遇到了同样的问题。我的解决方案是将字符串分成125个字符串的组,并在日志记录时进行迭代。我与AppCenter支持人员聊天。他们目前没有办法延长这一长度

以下是我的代码的删除版本:

var tokenChunks = LoggingHelper.SplitBy(extremelyLongString, 120);
string title = "Long string here";
var props = new Dictionary<string, string>();
int item = 0;
foreach(string chunk in tokenChunks)
{
    string chunkIndex = string.Format("item: {0}", item++);
    props.Add(chunkIndex, chunk);
}
Analytics.TrackEvent(title, props);
var-tokenChunks=LoggingHelper.SplitBy(extremelyLongString,120);
string title=“此处为长字符串”;
var props=newdictionary();
int项=0;
foreach(令牌块中的字符串块)
{
string chunkIndex=string.Format(“item:{0}”,item++);
添加(chunkIndex,chunk);
}
TrackEvent(标题、道具);
其中LoggingHelper类是:

public static class LoggingHelper
{
    public static IEnumerable<string> SplitBy(this string str, int chunkLength)
    {
        if (String.IsNullOrEmpty(str)) throw new ArgumentException();
        if (chunkLength < 1) throw new ArgumentException();

        for (int i = 0; i < str.Length; i += chunkLength)
        {
            if (chunkLength + i > str.Length)
                chunkLength = str.Length - i;

            yield return str.Substring(i, chunkLength);
        }
    }
}
公共静态类LoggingHelper
{
公共静态IEnumerable SplitBy(此字符串str,int chunkLength)
{
if(String.IsNullOrEmpty(str))抛出新的ArgumentException();
如果(chunkLength<1)抛出新ArgumentException();
for(int i=0;istr.Length)
chunkLength=str.Length-i;
收益率返回str.Substring(i,chunkLength);
}
}
}

我应该感谢@oleksii的这篇文章,因为它采用了SplitBy方法。

如果您已经通过添加
ex
作为第一个参数得到了完整的异常,那么为什么要使用
ex.ToString()
?这不是给你所有你需要的信息吗?除非你有创意,把信息分成125个字符块,每次都把它作为新的参数添加进去,否则我认为没有办法解决这个问题。我很确定参数的数量也有限制,所以这也只能让你达到目前为止。