New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSErrorException's Message property should contain more useful information #4133
Comments
…arin#4133 The default `Message` property is not every helpful. Better information is available inside the `Error` property but it's not general (nor cross platform) when dealing with exception. Include unit tests (on an existing test checking NSError values) xamarin#4133
Make sense :) The most useful information, coming from the native code, is the You can probably workaround this with something like |
I'm not sure, but I think the I would suggest to override Regarding your suggested workaround: I implemented a similar approch that uses reflection. Why reflection? The type |
I'll check if it's localized after WWDC (or in between sessions) |
I've been some days away from that topic. Coming back now, I agree, |
Enhancement: From my point of view,
NSErrorException
'sMessage
property should contain some information about the underlyingNSError
.Message
is currently "Exception of type 'Foundation.NSErrorException' was thrown."Consider a project that logs all unhandled exceptions (via
AppDomain.CurrentDomain.UnhandledException
) to a remote error tracking system (like Sentry) or to a log file. In almost all of the cases, these unhandled exceptions are bugs. The existingMessage
property does not help to understand the root cause of the bug and makes it hard to properly fix it.Steps to Reproduce
throw new NSErrorException(/* ... */)
AppDomain.CurrentDomain.UnhandledException += (_, e) => { Console.WriteLine(((Exception)e.ExceptionObject).Message); } ;
Expected Behavior
Message
should at least containNSError
'sCode
to be able to understand what the exception was about.Actual Behavior
Message
is "Exception of type 'Foundation.NSErrorException' was thrown."The text was updated successfully, but these errors were encountered: