Fixed problem with IncludeInOutput not being specified (#1045)#1046
Fixed problem with IncludeInOutput not being specified (#1045)#1046mgravell merged 4 commits intoprotobuf-net:mainfrom
Conversation
|
@mgravell This is actually a quite important fix, otherwise all existing usages will have to adapt their project files to include this new option. |
|
Oh, jeez. I guess, Nice catch and sorry for the blunder. |
|
I tried the following code (using csharp.godbolt.org): using System;
class Program
{
static void Main()
{
bool result = true;
var res = bool.TryParse("", out result);
Console.WriteLine(res);
Console.WriteLine(result);
}
}It seems that both res is This is actually documented behavior: https://learn.microsoft.com/en-us/dotnet/api/system.boolean.tryparse?view=net-7.0. We might have to refine the whole thing to be something like: var includeInOutput = true;
if (userOptions is not null && userOptions.TryGetValue(Literals.AdditionalFileMetadataPrefix + "IncludeInOutput", out var optionValue) && !bool.TryParse(optionValue, out var includeInOutput))
{
includeInOutput = true;
}Other suggestions? |
|
Would be nice if we also extend ProtoGeneratorTests.cs specifically L88 as such: }", new[] { ("ImportPaths", "../../"), ("IncludeInOutput", "") } ),With an empty IncludeInOutput to see that the change works. |
|
Merged to avoid problems, but I might tweak it again shortly - a useful trick is to use a temp for the TryBlah out variable |
No description provided.