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.
If you do not provide a default namespace in XAML, the XAML parser will throw a non-descript exception. The message will be:
System.ArgumentNullException: Value cannot be null.
The code can be found here:
It happens here:
if (clrNamespace == null)
throw new ArgumentNullException(nameof(clrNamespace));
The exception that is thrown is here should either be less generic and handled at a higher level, or the message of the exception should be more descriptive and should include a clear reason as to why the exception is being thrown.
Here are a few forum posts on the topic:
If the default xmlns is missing, the partial class won't be generated (XamlG) and the assembly won't compile, so you're not supposed to run the project, and get a runtime issue.
To get this, you're invoking an internal API, and the observed behavior is not a bug.
I got this error again today, so I googled for it, and saw my post here:
Which led my back to this bug. It's still a bug that needs to be fixed. The bug is that the error message needs to more descriptive. I don't know if this is a bug in Xamarin Forms, or a bug in Visual Studio, but regardless, the error message should say something like:
Default xmlns is missing. The partial class won't be generated for XAML file [INSERT FILENAME HERE].
It's not actually the default xmlns thought - it's the default namespace of the project.
I'm now getting this in the latest version of Xamarin Forms. 22.214.171.124203
And, I DO have a default namespace at the project. And, this is now control is defined in XAML:
<?xml version="1.0" encoding="UTF-8"?>
When I remove the XamlCompilation attribute, it compiles fine.
But, when I do remove the attribute, I get nothing on the screen. It's just blank.
I don't understand what's wrong in #c4. Please add a small retro-project.
I'm starting to have this error now too. The clrNamespace param is also null, but it is declared in the XAML file
I can't recreate it. It just happens sometimes and then stops happening.
closing as not reproducible.
if you can provide a reproduction project, please open an issue on https://github.com/xamarin/Xamarin.Forms/issues