You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class Foo {
protected virtual T? Serialization_Remove<T>(string Value) {
return default;
}
}
public class Foo1 : Foo {
}
Then go inside Foo1 and type override ser and press TAB and then Foo1 will have the following code:
public class Foo1 : Foo {
protected override T? Serialization_Remove<T>(string Value) {
return base.Serialization_Remove<T>(Value);
}
}
The auto-generated code does not compile! Oddly, however, altering the code as follows causes it to work:
public class Foo1 : Foo {
protected override T? Serialization_Remove<T>(string Value) where T : default { // Note the new where clause here
return base.Serialization_Remove<T>(Value);
}
}
Expected Behavior:
I believe there are two separate-but-related issues.
Issue 1
2. According to the docs the where T : default is necessary ...when a base class or interface declares two overloads of a method, one that specifies the struct constraint, and one that doesn't have either the struct or class constraint applied, however, as you see in the code above, there are not two overloads of a method. Because of this, I believe that the T : default should not be necessary.
Issue 2
The auto-generated code does not work. It should, regardless of how Issue1 is dealt with.
Actual Behavior:
Auto-generated code should work; ideally without needing the T : default constraint.
The text was updated successfully, but these errors were encountered:
Version Used:
VS 17.2.6
Steps to Reproduce:
override ser
and pressTAB
and then Foo1 will have the following code:Expected Behavior:
I believe there are two separate-but-related issues.
Issue 1
2. According to the docs the
where T : default
is necessary...when a base class or interface declares two overloads of a method, one that specifies the struct constraint, and one that doesn't have either the struct or class constraint applied
, however, as you see in the code above, there are not two overloads of a method. Because of this, I believe that theT : default
should not be necessary.Issue 2
The auto-generated code does not work. It should, regardless of how Issue1 is dealt with.
Actual Behavior:
Auto-generated code should work; ideally without needing the
T : default
constraint.The text was updated successfully, but these errors were encountered: