Source generator for blocking use of parameterless constructors! E.x. new SomeStruct() will result in a compile error.
https://www.nuget.org/packages/NoParamlessCtor
Declare a partial struct with the [NoParamlessCtor] attribute
Example:
[NoParamlessCtor]
public ref partial struct RefCtor(ref PrimaryCtor value)
{
public ref PrimaryCtor Value = ref value;
}- Structs that will have an invalid state if
new()-ed. Note that it is still possible for the end-user to declaredefault(SomeStruct).