Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6d03217

Browse files
authored
Merge pull request #151 from smasher164/null-exception
fix ArgumentNullException when accessing SymbolLocations
2 parents 6422619 + 510e96e commit 6d03217

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

nuget.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
6+
<add key="arcade" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
7+
</packageSources>
8+
</configuration>

src/PortToTripleSlash/src/libraries/Extensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Collections.Generic;
5+
using System.Linq;
56

67
namespace ApiDocsSync.PortToTripleSlash
78
{
@@ -59,6 +60,8 @@ public static string DocIdEscaped(this string docId) =>
5960
// Checks if the passed string is considered "empty" according to the Docs repo rules.
6061
public static bool IsDocsEmpty(this string? s) =>
6162
string.IsNullOrWhiteSpace(s) || s == Configuration.ToBeAdded;
63+
64+
public static bool HasItems<T>(this IEnumerable<T> src) => src?.Any() ?? false;
6265
}
6366

6467
}

src/PortToTripleSlash/src/libraries/ToTripleSlashPorter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private async Task CollectSymbolLocationsFromReferencedProjectsAsync(DocsType do
191191
}
192192
}
193193

194-
if (!docsType.SymbolLocations.Any())
194+
if (!docsType.SymbolLocations.HasItems())
195195
{
196196
Log.Error($"No symbols found for docs type '{docsType.DocId}'.");
197197
}

src/PortToTripleSlash/src/libraries/libraries.csproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Build" Version="17.2.0" ExcludeAssets="Runtime" />
15-
<PackageReference Include="Microsoft.Build.Framework" Version="17.2.0" ExcludeAssets="Runtime" />
16-
<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" />
17-
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.3.0-2.final" />
18-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4-beta1.22310.1">
14+
<PackageReference Include="Microsoft.Build" Version="17.4.0" ExcludeAssets="Runtime" />
15+
<PackageReference Include="Microsoft.Build.Framework" Version="17.4.0" ExcludeAssets="Runtime" />
16+
<PackageReference Include="Microsoft.Build.Locator" Version="1.5.5" />
17+
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.5.0-2.final" />
18+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4-beta1.22559.1">
1919
<PrivateAssets>all</PrivateAssets>
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
</PackageReference>
22-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.0-2.final" />
23-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.0-2.final" />
24-
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.3.0-2.final" />
25-
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0-preview.6.22324.4" />
22+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0-2.final" />
23+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.5.0-2.final" />
24+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.5.0-2.final" />
25+
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
2626
</ItemGroup>
2727

2828
</Project>

src/PortToTripleSlash/tests/tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
</ItemGroup>
2929

3030
<ItemGroup>
31-
<PackageReference Include="Microsoft.Build" Version="17.2.0" ExcludeAssets="Runtime" />
32-
<PackageReference Include="Microsoft.Build.Framework" Version="17.2.0" ExcludeAssets="Runtime" />
33-
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" Version="8.0.0-beta.22579.2" />
34-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0-preview-20220707-01" />
35-
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0-preview.6.22324.4" />
31+
<PackageReference Include="Microsoft.Build" Version="17.4.0" ExcludeAssets="Runtime" />
32+
<PackageReference Include="Microsoft.Build.Framework" Version="17.4.0" ExcludeAssets="Runtime" />
33+
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" Version="8.0.0-beta.23060.7" />
34+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221221-03" />
35+
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
3636
<PackageReference Include="xunit" Version="2.4.2" />
3737
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
3838
<PrivateAssets>all</PrivateAssets>

0 commit comments

Comments
 (0)