There'e multiple scenarios when compilling axaml throws internal compiller error (ArgumentOutOfRangeException). This exception occures when you have in source axaml file any xml elements of types which has no Content property and has no any Add method, but contains any nested elements. I faced with this trying to add objects into DataGrid, but it reproduces for other object types.
XamlTransformException: Internal compiler error: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index (ResolveContentPropertyTransformer) Line 37, position 6.
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at XamlX.Transform.Transformers.ResolveContentPropertyTransformer.Transform(AstTransformationContext context, IXamlAstNode node) in D:\Git\AvaloniaUI\Avalonia\src\Markup\Avalonia.Markup.Xaml.Loader\xamlil.github\src\XamlX\Transform\Transformers\ResolveContentPropertyTransformer.cs
... <truncated>
Expected behavior
Compilation error No Content property or any Add methods found for type <type name>.
There'e multiple scenarios when compilling axaml throws internal compiller error (ArgumentOutOfRangeException). This exception occures when you have in source axaml file any xml elements of types which has no Content property and has no any Add method, but contains any nested elements. I faced with this trying to add objects into DataGrid, but it reproduces for other object types.
How to Reproduce
Scenario 1 (DataGrid):
Scenario 2 (Object):
In both scenarios on compilling:
Expected behavior
Compilation error
No Content property or any Add methods found for type <type name>.
Additional info
More detaile here