Skip to content

Add IParsable and Parse/TryParse hoisting #989

Add IParsable and Parse/TryParse hoisting

Add IParsable and Parse/TryParse hoisting #989

Triggered via pull request April 18, 2024 07:28
@SteveDunnSteveDunn
synchronize #570
iparsable
Status Failure
Total duration 21m 15s
Artifacts

build.yaml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

13 errors
ubuntu-latest
Process completed with exit code 1.
windows-latest
Process completed with exit code 1.
macOS-latest
Process completed with exit code 1.
SnapshotTests.Parsing.ParsingTestsForStrings.Generates_IParsable_except_if_it_is_already_specified
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v7.0 New: - Received: ParsingTestsForStrings.Generates_IParsable_except_if_it_is_already_specified.received.txt Verified: ParsingTestsForStrings.Generates_IParsable_except_if_it_is_already_specified.verified.txt FileContent: New: Received: ParsingTestsForStrings.Generates_IParsable_except_if_it_is_already_specified.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(CitySystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(CityTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(CityDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.String, Value = { _value }")] public partial struct City : global::System.IEquatable<City>, global::System.IEquatable<System.String>, global::System.IComparable<City>, global::System.IComparable, global::System.IParsable<City> { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.String _value; /// <summary> /// Gets the underlying <see cref="System.String" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public readonly System.String Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public City() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private City(System.String value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static City From(System.String value) { City instance = new City(value); return instance; }
SnapshotTests.Parsing.ParsingTestsForPrimitives.Generates_IParsable_for_a_class_wrapping_an_int
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForPrimitives.Generates_IParsable_for_a_class_wrapping_an_int.received.txt Verified: ParsingTestsForPrimitives.Generates_IParsable_for_a_class_wrapping_an_int.verified.txt FileContent: New: Received: ParsingTestsForPrimitives.Generates_IParsable_for_a_class_wrapping_an_int.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyVoSystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyVoTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyVoDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Int32, Value = { _value }")] public partial class MyVo : global::System.IEquatable<MyVo>, global::System.IEquatable<System.Int32> , global::System.IComparable<MyVo>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.Int32 _value; /// <summary> /// Gets the underlying <see cref="System.Int32" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public System.Int32 Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyVo() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyVo(System.Int32 value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static MyVo From(System.Int32 value) { MyVo instance = new MyVo(value); return instance; } // only called internally when something has been deseriali
SnapshotTests.Parsing.ParsingTestsForStrings.Generates_IParsable
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForStrings.Generates_IParsable.received.txt Verified: ParsingTestsForStrings.Generates_IParsable.verified.txt FileContent: New: Received: ParsingTestsForStrings.Generates_IParsable.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyClassSystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyClassTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyClassDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.String, Value = { _value }")] public partial struct MyClass : global::System.IEquatable<MyClass>, global::System.IEquatable<System.String>, global::System.IComparable<MyClass>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.String _value; /// <summary> /// Gets the underlying <see cref="System.String" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public readonly System.String Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyClass() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyClass(System.String value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static MyClass From(System.String value) { MyClass instance = new MyClass(value); return instance; } public static explicit operator MyClass(System.String value) => From(value);
SnapshotTests.Parsing.ParsingTestsForPrimitives.Does_not_generate_IParsable_for_a_class_wrapping_a_bool_because_it_implements_it_privately
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForPrimitives.Does_not_generate_IParsable_for_a_class_wrapping_a_bool_because_it_implements_it_privately.received.txt Verified: ParsingTestsForPrimitives.Does_not_generate_IParsable_for_a_class_wrapping_a_bool_because_it_implements_it_privately.verified.txt FileContent: New: Received: ParsingTestsForPrimitives.Does_not_generate_IParsable_for_a_class_wrapping_a_bool_because_it_implements_it_privately.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyVoSystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyVoTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyVoDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Boolean, Value = { _value }")] public partial class MyVo : global::System.IEquatable<MyVo>, global::System.IEquatable<System.Boolean> , global::System.IComparable<MyVo>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.Boolean _value; /// <summary> /// Gets the underlying <see cref="System.Boolean" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public System.Boolean Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyVo() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyVo(System.Boolean value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static MyVo From(System.Boolean value) { MyVo inst
SnapshotTests.Parsing.ParsingTestsForStrings.Generates_IParsable_for_record_structs
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForStrings.Generates_IParsable_for_record_structs.received.txt Verified: ParsingTestsForStrings.Generates_IParsable_for_record_structs.verified.txt FileContent: New: Received: ParsingTestsForStrings.Generates_IParsable_for_record_structs.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyVoSystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyVoTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyVoDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.String, Value = { _value }")] public readonly partial record struct MyVo : global::System.IEquatable<MyVo>, global::System.IEquatable<System.String>, global::System.IComparable<MyVo>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.String _value; /// <summary> /// Gets the underlying <see cref="System.String" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public readonly System.String Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } [global::System.Diagnostics.DebuggerStepThroughAttribute] init { if (value is null) { throw new global::Vogen.ValueObjectValidationException("Cannot create a value object with null."); } _value = value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyVo() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyVo(System.String value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type.
SnapshotTests.Parsing.ParsingTestsForPrimitives.Ignores_TryParse_where_last_parameter_is_not_out
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForPrimitives.Ignores_TryParse_where_last_parameter_is_not_out.received.txt Verified: ParsingTestsForPrimitives.Ignores_TryParse_where_last_parameter_is_not_out.verified.txt FileContent: New: Received: ParsingTestsForPrimitives.Ignores_TryParse_where_last_parameter_is_not_out.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyClass2SystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyClass2TypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyClass2DebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Int32, Value = { _value }")] public partial struct MyClass2 : global::System.IEquatable<MyClass2>, global::System.IEquatable<System.Int32>, global::System.IComparable<MyClass2>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.Int32 _value; /// <summary> /// Gets the underlying <see cref="System.Int32" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public readonly System.Int32 Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyClass2() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyClass2(System.Int32 value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static MyClass2 From(System.Int32 value) { MyClass2 instance = new MyClass2(value); return instance; }
SnapshotTests.Parsing.ParsingTestsForStrings.Generates_IParsable_for_a_class_wrapping_a_string
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForStrings.Generates_IParsable_for_a_class_wrapping_a_string.received.txt Verified: ParsingTestsForStrings.Generates_IParsable_for_a_class_wrapping_a_string.verified.txt FileContent: New: Received: ParsingTestsForStrings.Generates_IParsable_for_a_class_wrapping_a_string.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyVoSystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyVoTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyVoDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.String, Value = { _value }")] public partial class MyVo : global::System.IEquatable<MyVo>, global::System.IEquatable<System.String> , global::System.IComparable<MyVo>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.String _value; /// <summary> /// Gets the underlying <see cref="System.String" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public System.String Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyVo() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyVo(System.String value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static MyVo From(System.String value) { if (value is null) { throw new global::Vogen.ValueObjectValidationException("Cannot create a value object with null."); }
SnapshotTests.Parsing.ParsingTestsForPrimitives.Does_not_generate_IParsable_in_versions_of_dotnet_prior_to_7
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForPrimitives.Does_not_generate_IParsable_in_versions_of_dotnet_prior_to_7.received.txt Verified: ParsingTestsForPrimitives.Does_not_generate_IParsable_in_versions_of_dotnet_prior_to_7.verified.txt FileContent: New: Received: ParsingTestsForPrimitives.Does_not_generate_IParsable_in_versions_of_dotnet_prior_to_7.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyVoSystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyVoTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyVoDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Int32, Value = { _value }")] public partial class MyVo : global::System.IEquatable<MyVo>, global::System.IEquatable<System.Int32> , global::System.IComparable<MyVo>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.Int32 _value; /// <summary> /// Gets the underlying <see cref="System.Int32" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public System.Int32 Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyVo() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyVo(System.Int32 value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static MyVo From(System.Int32 value) { MyVo instance = new MyVo(value); return instance; } // only called inter
SnapshotTests.Parsing.ParsingTestsForStrings.Generates_IParsable_and_calls_our_validation_method
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForStrings.Generates_IParsable_and_calls_our_validation_method.received.txt Verified: ParsingTestsForStrings.Generates_IParsable_and_calls_our_validation_method.verified.txt FileContent: New: Received: ParsingTestsForStrings.Generates_IParsable_and_calls_our_validation_method.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyClassSystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyClassTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyClassDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.String, Value = { _value }")] public partial struct MyClass : global::System.IEquatable<MyClass>, global::System.IEquatable<System.String>, global::System.IComparable<MyClass>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.String _value; /// <summary> /// Gets the underlying <see cref="System.String" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public readonly System.String Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyClass() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyClass(System.String value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static MyClass From(System.String value) { var validation = MyClass.Validate(value); if (validation != Vogen.Validation.Ok)
SnapshotTests.Parsing.ParsingTestsForPrimitives.Generates_IParsable
VerifyException : Directory: D:\a\Vogen\Vogen\tests\SnapshotTests\Parsing\snapshots\snap-v6.0 New: - Received: ParsingTestsForPrimitives.Generates_IParsable.received.txt Verified: ParsingTestsForPrimitives.Generates_IParsable.verified.txt FileContent: New: Received: ParsingTestsForPrimitives.Generates_IParsable.received.txt // ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a source generator named Vogen (https://github.com/SteveDunn/Vogen) // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0618 // Suppress warnings for 'Override methods on comparable types'. #pragma warning disable CA1036 // Suppress Error MA0097 : A class that implements IComparable<T> or IComparable should override comparison operators #pragma warning disable MA0097 // Suppress warning for 'The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.' // The generator copies signatures from the BCL, e.g. for `TryParse`, and some of those have nullable annotations. #pragma warning disable CS8669 // Suppress warnings about CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' #pragma warning disable CS1591 using Vogen; namespace Whatever { [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Vogen", "1.0.0.0")] [global::System.Text.Json.Serialization.JsonConverter(typeof(MyClassSystemTextJsonConverter))] [global::System.ComponentModel.TypeConverter(typeof(MyClassTypeConverter))] [global::System.Diagnostics.DebuggerTypeProxyAttribute(typeof(MyClassDebugView))] [global::System.Diagnostics.DebuggerDisplayAttribute("Underlying type: System.Int32, Value = { _value }")] public partial struct MyClass : global::System.IEquatable<MyClass>, global::System.IEquatable<System.Int32>, global::System.IComparable<MyClass>, global::System.IComparable { #if DEBUG private readonly global::System.Diagnostics.StackTrace _stackTrace = null; #endif private readonly global::System.Boolean _isInitialized; private readonly System.Int32 _value; /// <summary> /// Gets the underlying <see cref="System.Int32" /> value if set, otherwise a <see cref="ValueObjectValidationException" /> is thrown. /// </summary> public readonly System.Int32 Value { [global::System.Diagnostics.DebuggerStepThroughAttribute] get { EnsureInitialized(); return _value; } } [global::System.Diagnostics.DebuggerStepThroughAttribute] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] public MyClass() { #if DEBUG _stackTrace = new global::System.Diagnostics.StackTrace(); #endif _isInitialized = false; _value = default; } [global::System.Diagnostics.DebuggerStepThroughAttribute] private MyClass(System.Int32 value) { _value = value; _isInitialized = true; } /// <summary> /// Builds an instance from the provided underlying type. /// </summary> /// <param name="value">The underlying type.</param> /// <returns>An instance of this type.</returns> public static MyClass From(System.Int32 value) { MyClass instance = new MyClass(value); return instance; } public static explicit operator MyClass(System.Int32 value) => From(value);