Skip to content

Commit 1e3a8a7

Browse files
committed
Workaround for NuGet restore bug
1 parent 1eac263 commit 1e3a8a7

File tree

2 files changed

+27
-32
lines changed

2 files changed

+27
-32
lines changed

Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<OSName Condition="'$(OSName)' == '' AND $(PortableTargetRid) != ''">$(PortableTargetRid.Substring(0, $(PortableTargetRid.LastIndexOf('-'))))</OSName>
2626
<OSName Condition="'$(OSName)' == '' AND $(TargetRid) != ''">$(TargetRid.Substring(0, $(TargetRid.LastIndexOf('-'))))</OSName>
2727
<OSName Condition="'$(OSName)' == ''">$(HostOSName)</OSName>
28+
29+
<!-- Workaround for https://github.com/NuGet/Home/issues/14745 -->
30+
<SDKAnalysisLevel>10.0.200</SDKAnalysisLevel>
2831
</PropertyGroup>
2932

3033
<PropertyGroup>

src/System.CommandLine.StaticCompletions/DynamicSymbolExtensions.cs

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ namespace System.CommandLine.StaticCompletions;
66
/// </summary>
77
public static class DynamicSymbolExtensions
88
{
9-
private static readonly Lock s_guard = new();
10-
119
/// <summary>
1210
/// The state that is used to track which symbols are dynamic.
1311
/// </summary>
@@ -20,44 +18,38 @@ public static class DynamicSymbolExtensions
2018
/// </summary>
2119
public bool IsDynamic
2220
{
23-
get
24-
{
25-
lock (s_guard)
26-
{
27-
return s_dynamicSymbols.GetValueOrDefault(option, false);
28-
}
29-
}
30-
set
31-
{
32-
lock (s_guard)
33-
{
34-
s_dynamicSymbols[option] = value;
35-
}
36-
}
21+
get => s_dynamicSymbols.GetValueOrDefault(option, false);
22+
set => s_dynamicSymbols[option] = value;
23+
}
24+
25+
/// <summary>
26+
/// Mark this option as requiring dynamic completions.
27+
/// </summary>
28+
/// <returns></returns>
29+
public Option RequiresDynamicCompletion()
30+
{
31+
option.IsDynamic = true;
32+
return option;
3733
}
3834
}
3935

4036
extension(Argument argument)
4137
{
42-
/// <summary>
4338
/// Indicates whether this argument requires a dynamic call into the dotnet process to compute completions.
44-
/// </summary>
4539
public bool IsDynamic
4640
{
47-
get
48-
{
49-
lock (s_guard)
50-
{
51-
return s_dynamicSymbols.GetValueOrDefault(argument, false);
52-
}
53-
}
54-
set
55-
{
56-
lock (s_guard)
57-
{
58-
s_dynamicSymbols[argument] = value;
59-
}
60-
}
41+
get => s_dynamicSymbols.GetValueOrDefault(argument, false);
42+
set => s_dynamicSymbols[argument] = value;
43+
}
44+
45+
/// <summary>
46+
/// Mark this argument as requiring dynamic completions.
47+
/// </summary>
48+
/// <returns></returns>
49+
public Argument RequiresDynamicCompletion()
50+
{
51+
argument.IsDynamic = true;
52+
return argument;
6153
}
6254
}
6355
}

0 commit comments

Comments
 (0)