Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
The completion Action<NSError> field of the CallKit:ReportNewIncomingCall function is allowed to be null'd by the compiler, but will crash at runtime if it's null. The compiler should enforce this to avoid confusion/developer issues.
It seems that generator does not honor the absence of NullAllowed on blocks
The generated code does include a null check for the `completion` parameter.
public unsafe virtual void ReportNewIncomingCall (NSUuid uuid, CXCallUpdate update, [BlockProxy (typeof (ObjCRuntime.Trampolines.NIDActionArity1V8))]global::System.Action<NSError> completion)
if (uuid == null)
throw new ArgumentNullException ("uuid");
if (update == null)
throw new ArgumentNullException ("update");
if (completion == null)
throw new ArgumentNullException ("completion");
Please provide a test case that shows how you could use a null `completion` parameter and crash at runtime.
I don't actually need it to *allow* a NULL handler, I probably should be providing one. That said, when I initially implemented, I simply set that field to NULL and the compiler let the application build, but it crashed at runtime. I'm not at a machine that has the preview builds installed at the moment, so I can't provide an example, but it should be as simple as calling:
ReportNewIncomingCall(new NSUuid(), update, null);
So it was likely an ArgumentNullException that caused your original crash.
The C# compiler does not allow enforcing non-null attributes. All the .NET BCL and our bindings enforce such checks at runtime.
We're looking how some additional tooling (e.g. roslyn code analyzers) could help spot such issues but this are not planned for the immediate future.