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
CustomOptions on Descriptors is now Obsolete. The replacement GetOption throws an exception if the descriptor has no options. Is there any way to test for this now?
The only workaround I can find is simply using the old way of doing a TryGet, which is an Obsolete way of doing it. CustomOptions doesn't even provide a way to determine if it is
//if I have to do this, I might as well just get the message when I check, but this is for example purposes
if (messageDescriptor?.CustomOptions.TryGetBytes(SomeExtensions.SomeOption.FieldNumber, out var nothing) ?? false)
{
//this line will throw if the message has no `CustomOptions`
SomeOption o = messageDescriptor?.GetOption<SomeOption>(SomeExtensions.SomeOption);
return o;
}
return null;
I'm trying to test messages dynamically for options that they may not have.
The text was updated successfully, but these errors were encountered:
thesoftwarejedi
changed the title
CustomOptions no longer has a way to test a descriptor for options
C# .NET CustomOptions no longer has a way to test a descriptor for options
Feb 21, 2020
jtattermusch
changed the title
C# .NET CustomOptions no longer has a way to test a descriptor for options
C# .NET GetOption no longer has a way to test a descriptor for options
Apr 22, 2020
jtattermusch
changed the title
C# .NET GetOption no longer has a way to test a descriptor for options
C# .NET GetOption doesn't have a way to test a descriptor for options
Apr 22, 2020
Regarding the recent C# Custom Options
CustomOptions
on Descriptors is nowObsolete
. The replacementGetOption
throws an exception if the descriptor has no options. Is there any way to test for this now?The only workaround I can find is simply using the old way of doing a
TryGet
, which is anObsolete
way of doing it.CustomOptions
doesn't even provide a way to determine if it isI'm trying to test messages dynamically for options that they may not have.
CC: @ObsidianMinor
The text was updated successfully, but these errors were encountered: