igood / boilerplatezero Goto Github PK
View Code? Open in Web Editor NEWboilerplatezero is a collection of C# source generators
License: MIT License
boilerplatezero is a collection of C# source generators
License: MIT License
When the project has Documentation generation enabled, it causes a warning.
Probably should be a template (G|S)ets the value of {DependencyPropertyName} on the given <see href="DependencyObject"/>.
I added a DependencyProperty to my WPF project (.NET 5.0, VS 2022) MainWindow class:
private static readonly DependencyPropertyKey FilenamePropertyKey = Gen.Filename<string>();
Visual Studio reports the following errors:
error CS0102: The type 'MainWindow' already contains a definition for 'FilenameProperty'
error CS0102: The type 'MainWindow' already contains a definition for 'Filename'
error CS0111: Type 'MainWindow.Gen' already defines a member called 'Filename' with the same parameter types
The auto-generated file looks fine:
partial class MainWindow
{
public static readonly DependencyProperty FilenameProperty = FilenamePropertyKey.DependencyProperty;
/// <summary>Gets the value of the <see cref="FilenameProperty"/> dependency property.</summary>
public string Filename
{
get => (string)this.GetValue(FilenameProperty);
private set => this.SetValue(FilenamePropertyKey, value);
}
private static partial class Gen
{
/// <summary>
/// Registers a read-only dependency property named "Filename" whose type is <typeparamref name="__T"/>.
/// </summary>
public static DependencyPropertyKey Filename<__T>()
{
var metadata = (PropertyMetadata)null!;
return DependencyProperty.RegisterReadOnly("Filename", typeof(__T), typeof(MainWindow), metadata, null);
}
}
}
What could be causing this? I varied types and names, and if I add a second property, I get errors for that as well. Adding Bpx.Test to my solution causes no problems, the project compiles fine.
Need to support usage something like this...
public static readonly DependencyProperty FooProperty = GenAttached.Foo(
"asdf", FrameworkPropertyMetadataOptions.Inherits);
public static readonly DependencyProperty BarProperty = Gen.Bar<int>(
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault);
The subject line says it all, but basically all the forms of Register{Attached}{ReadOnly} have an overload where the final parameter is of type ValidateValueCallback
, but boilerplatezero does not have anything in place to add that to the generated call.
property-changed methods need to be included in the metadata
a string
property named Foo
should automatically support things like the following methods:
private static void FooPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { }
private static void FooPropertyChanged(MyClass self, DependencyPropertyChangedEventArgs e) { }
protected virtual void OnFooChanged(DependencyPropertyChangedEventArgs e) { }
private void OnFooChanged(string oldFoo, string newFoo) { }
When creating a Dependency Property of a closed generic type (for example, a List<object>
) the following documentation comment is generated:
/// <summary>
/// Registers a dependency property named "Objects" whose type is <see cref="System.Collections.Generic.List{object}"/>.
/// </summary>
This looks fine, but specifying the type in the {...}
is not valid apparently, so it should be:
/// <summary>
/// Registers a dependency property named "Objects" whose type is <see cref="System.Collections.Generic.List{T}"/> of <see cref="object"/>.
/// </summary>
or, since you're already using generics for the method signature, just use this:
/// <summary>
/// Registers a dependency property named "Objects" whose type is <typeparamref name="__T"/>.
/// </summary>
This causes a compiler warning when GenerateDocumentationFile
is enabled.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.