SimonSimCity / Xamarin-CrossDownloadManager

A cross platform download manager for Xamarin
MIT License
149 stars 68 forks source link

NullPointerException #113

Open frankHarmann opened 5 years ago

frankHarmann commented 5 years ago

Steps to reproduce

unknown, happens randomly (only very sporadic)

Expected behavior

no crash

Actual behavior

<2019-04-02 13:14:52.640> Thread([28]) - AppDelegate.LogUnhandledException(Exception) (exception=System.Exception: CurrentDomainOnUnhandledException ---> System.NullReferenceException: Object reference not set to an instance of an object at Plugin.DownloadManager.UrlSessionDownloadDelegate.DidCompleteWithError (Foundation.NSUrlSession session, Foundation.NSUrlSessionTask task, Foundation.NSError error) <0x1053747b0 + 0x00028> in <4827c03515ed4a5dbd19c33d9b81f2a1#079ea52387256c0e69a46aa087d77b95>:0 --- End of inner exception stack trace ---).

Looking at the code there probably should be null pointer check for task and error objects in all methods of UrlSessionDelegate in order to prevent nullReferenceExceptions (or try/catch/ignore wrappers).

Configuration

Platform: iOS, develop branch

Device: Real device (iPad Pro 3 12.9in (J321AP), iOS 12.1.4)

SimonSimCity commented 5 years ago

Would you have time to write a PR for this? 😉

SimonSimCity commented 5 years ago

Well ... according to the method that was called, there was an error, so it would be nice to know if the file could be downloaded - I guess not. But a detailed error message by iOS would help a lot. Otherwise we can only set the error-details to an empty string.