Can Uno.Extensions.Markup.Generators be disabled for selected types ?? #16106
-
According to this article Generating Extensions the markup generator will "scan that project and automatically generate extensions for the types that are found". I am encountering compile-time errors with the markup code being generated when it encounters any of my generic abstract controls. Suppose I have a generic abstract widget control called MyWidgetAbstract. I will see hundreds of compile time errors related to a file called MyProject.Controls.MyWidgetAbstractMarkup.g.cs. Is there a way to turn off or disable markup generation for just MyWidgetAbstract ?? Perhaps some kind of attribute ?? I have about a dozen of these generic abstract classes that essentially do Strongly Typed DataContext
but that were written LONG BEFORE strongly typed bindings extensions ever existed. I would eventually love to refactor the code to use strongly typed bindings extensions - but I cannot presently undertake that task. Currently, I just want to get rid of the compile time conflicts. I like the idea of 'automatically generat[ing] extensions for [all] the types that are found". Ideally, I would prefer to keep automatic generation for all types, rather than turning it off universally, and then re-enabling it for every single class (except for the dozen abstracts). Is there a way ?? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Are the classes actually marked as abstract? Can you give an example of the class declaration? If that's the case, the generator should ignore those abstract classes @dansiegel |
Beta Was this translation helpful? Give feedback.
-
Well, at least in my case @francoistanguay is correct. Historically XAML code behind generators have never worked with generic classes, but they have always worked with concrete classes based on the generic. Thats exactly why we have the pattern we currently have - because of the way XAML code behind generators work. From the compiler errors I observe, it appears that the Uno.Extensions.Markup.Generators are actually working on the derived classes. The compiler errors are in the markup code being generated when it encounters any of my generic abstract controls. I don't need or want the markup code generated for the abstract classes - but there is no way to turn it off. Consequently, the entire project fails to compile. Ideally, there would be an attribute to disable markup generation for generic abstract classes. As long as it allowed the code generators to operate on any derived class, a C# code attribute like this should eliminate the compile errors:
Can you please take a second look at this issue and share your thoughts. |
Beta Was this translation helpful? Give feedback.
Have you tried with latest Uno updates? I thought the latest Markup generators were skipping classes with generic arguments now so you wouldn't need to put any attributes.