Xamarin.ios 手动捕获到的crash符号化的问题

2019-01-10 14:05发布

ios设备产生的crash文件根据Archives或者dSYM文件符号化成可识别的内容网上很多,但是这里要问的不是这个。因为app只是内部系统,并没有放到Appstore中,因此不能使用Appstore的crash收集功能。于是叫客户手动获取crash并发给我们。一开始客户还是愿意手动把crash给过来的,但是后面开始嫌麻烦,让我们做自动上传的功能。但是ios貌似是不允许app操作crash文件的,于是就有了下面的代码出现,自己手动捕获。废话不多说,上代码。

复制代码
public class Application
    {
        // This is the main entry point of the application.
        static void Main (string[] args)
        {
            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            try {
                UIApplication.Main(args, null, "AppDelegate");
            } catch (Exception ex) {
                string documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                string filename = Path.Combine(documents, "myCrash.txt");
                string splitString = "#split#";
                string content = ex.ToString() + splitString + DateTime.Now.ToString() + splitString + (LoginInfo.wUserCName ?? "")
                    + splitString + (LoginInfo.wVersion ?? "");
                File.WriteAllText(filename, content);
            }
        }
    }
复制代码

简单粗暴,确实能捕获到一些有用信息(只能捕获到主线程的,因此如果子线程有可能会crash的操作,对子线程try/catch,并在catch中BeginInvokeOnMainThread把exception throw 出来)。全局捕获异常并记录下来,下次打开app的时候通过wcf上传到DB中。然而,调试环境下产生完全可读的错误,在真机中却是会有部分未符号化的内容。

这个是调试环境捕获到的crash:

System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exception details. ---> System.TimeoutException: The operation has timed out.
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_delegate_end_invoke (object,intptr)
at (wrapper delegate-end-invoke) <Module>:end_invoke_object__this___object[]&_IAsyncResult (object[]&,System.IAsyncResult)
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.EndProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters, System.IAsyncResult result) [0x00025] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.8.0.175/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:460
at System.ServiceModel.ClientBase`1+ChannelBase`1[TChannel,T].EndInvoke (System.String methodName, System.Object[] args, System.IAsyncResult result) [0x0003c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.8.0.175/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs:404
at Acs.RollsMary.Maroon.Core.PlaceService.PlaceService_NotePadClient+PlaceService_NotePadClientChannel.EndGetDocumentByCategoryType (System.IAsyncResult result) [0x00008] in F:\IPad\Acs.RollsMary.Maroon.Core\Service References\PlaceService\Reference.cs:30064
at Acs.RollsMary.Maroon.Core.PlaceService.PlaceService_NotePadClient.Acs.RollsMary.Maroon.Core.PlaceService.IPlaceService_NotePad.EndGetDocumentByCategoryType (System.IAsyncResult result) [0x00001] in F:\IPad\Acs.RollsMary.Maroon.Core\Service References\PlaceService\Reference.cs:27734
at Acs.RollsMary.Maroon.Core.PlaceService.PlaceService_NotePadClient.OnEndGetDocumentByCategoryType (System.IAsyncResult result) [0x00001] in F:\IPad\Acs.RollsMary.Maroon.Core\Service References\PlaceService\Reference.cs:27743

 

这个是真机中捕获到的crash:

System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exception details. ---> System.TimeoutException: The operation has timed out.
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_delegate_end_invoke (object,intptr)
at (wrapper delegate-end-invoke) <Module>:end_invoke_object__this___object[]&_IAsyncResult (object[]&,System.IAsyncResult)
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.EndProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters, System.IAsyncResult result) <0x100e1b980 + 0x0004b> in <220dfdb330c54319abf8948e4174d84b#565b21b1fe7c3ca144f793b1f2b173e0>:0
at System.ServiceModel.ClientBase`1+ChannelBase`1[TChannel,T].EndInvoke (System.String methodName, System.Object[] args, System.IAsyncResult result) <0x100e112b0 + 0x00087> in <220dfdb330c54319abf8948e4174d84b#565b21b1fe7c3ca144f793b1f2b173e0>:0
at Acs.RollsMary.Maroon.Core.PlaceService.PlaceService_NotePadClient+PlaceService_NotePadClientChannel.EndGetDocumentByCategoryType (System.IAsyncResult result) <0x100a52600 + 0x00043> in <ebcebe22c152411293c83e7ea6277585#565b21b1fe7c3ca144f793b1f2b173e0>:0
at Acs.RollsMary.Maroon.Core.PlaceService.PlaceService_NotePadClient.Acs.RollsMary.Maroon.Core.PlaceService.IPlaceService_NotePad.EndGetDocumentByCategoryType (System.IAsyncResult result) <0x100a40ef0 + 0x00043> in <ebcebe22c152411293c83e7ea6277585#565b21b1fe7c3ca144f793b1f2b173e0>:0
at Acs.RollsMary.Maroon.Core.PlaceService.PlaceService_NotePadClient.OnEndGetDocumentByCategoryType (System.IAsyncResult result) <0x100a41010 + 0x0003b> in <ebcebe22c152411293c83e7ea6277585#565b21b1fe7c3ca144f793b1f2b173e0>:0

 

眼尖的你们应该能发现那些未被符号化的东东了,这就是我这里要提问的问题:如何把这些基址和偏移符号化。网上找的最接近的应该就是说用xcode自带的atos,但我试过这个貌似还是符号化不了。

https://www.cnblogs.com/MatyLin/p/7814718.html

有没有对这方面比较了解的前辈指导下。

1条回答
Melony?
2楼-- · 2019-01-10 14:28

這麼久居然還沒人回答。。。

查看更多
登录 后发表回答