Skip to content

Commit 37d76f5

Browse files
authored
Merge pull request #6791 from hvitved/csharp/update-nuget-packages
C#: Update nuget packages
2 parents 6fda5e8 + 26194be commit 37d76f5

File tree

25 files changed

+292
-311
lines changed

25 files changed

+292
-311
lines changed

cpp/autobuilder/Semmle.Autobuild.Cpp/Semmle.Autobuild.Cpp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
20+
<PackageReference Include="Microsoft.Build" Version="16.11.0" />
2121
</ItemGroup>
2222

2323
<ItemGroup>
Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
5-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
6-
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
7-
<Nullable>enable</Nullable>
8-
</PropertyGroup>
9-
10-
<ItemGroup>
11-
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
12-
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
13-
<PackageReference Include="xunit" Version="2.4.1" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
15-
<PrivateAssets>all</PrivateAssets>
16-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
17-
</PackageReference>
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
19-
</ItemGroup>
20-
21-
<ItemGroup>
22-
<ProjectReference Include="..\Semmle.Autobuild.CSharp\Semmle.Autobuild.CSharp.csproj" />
23-
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
24-
</ItemGroup>
25-
</Project>
2+
<PropertyGroup>
3+
<TargetFramework>net5.0</TargetFramework>
4+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
5+
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<PackageReference Include="System.IO.FileSystem" Version="4.3.0"/>
10+
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0"/>
11+
<PackageReference Include="xunit" Version="2.4.1"/>
12+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
13+
<PrivateAssets>all</PrivateAssets>
14+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
15+
</PackageReference>
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0"/>
17+
</ItemGroup>
18+
<ItemGroup>
19+
<ProjectReference Include="..\Semmle.Autobuild.CSharp\Semmle.Autobuild.CSharp.csproj"/>
20+
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj"/>
21+
</ItemGroup>
22+
</Project>
Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
5-
<AssemblyName>Semmle.Autobuild.CSharp</AssemblyName>
6-
<RootNamespace>Semmle.Autobuild.CSharp</RootNamespace>
7-
<ApplicationIcon />
8-
<OutputType>Exe</OutputType>
9-
<StartupObject />
10-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
11-
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
12-
<Nullable>enable</Nullable>
13-
</PropertyGroup>
14-
15-
<ItemGroup>
16-
<Folder Include="Properties\" />
17-
</ItemGroup>
18-
19-
<ItemGroup>
20-
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
21-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
22-
</ItemGroup>
23-
24-
<ItemGroup>
25-
<ProjectReference Include="..\..\extractor\Semmle.Util\Semmle.Util.csproj" />
26-
<ProjectReference Include="..\..\extractor\Semmle.Extraction.CSharp\Semmle.Extraction.CSharp.csproj" />
27-
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
28-
</ItemGroup>
29-
30-
</Project>
2+
<PropertyGroup>
3+
<TargetFramework>net5.0</TargetFramework>
4+
<AssemblyName>Semmle.Autobuild.CSharp</AssemblyName>
5+
<RootNamespace>Semmle.Autobuild.CSharp</RootNamespace>
6+
<ApplicationIcon/>
7+
<OutputType>Exe</OutputType>
8+
<StartupObject/>
9+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
10+
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
11+
<Nullable>enable</Nullable>
12+
</PropertyGroup>
13+
<ItemGroup>
14+
<Folder Include="Properties\"/>
15+
</ItemGroup>
16+
<ItemGroup>
17+
<PackageReference Include="Microsoft.Build" Version="16.11.0"/>
18+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
19+
</ItemGroup>
20+
<ItemGroup>
21+
<ProjectReference Include="..\..\extractor\Semmle.Util\Semmle.Util.csproj"/>
22+
<ProjectReference Include="..\..\extractor\Semmle.Extraction.CSharp\Semmle.Extraction.CSharp.csproj"/>
23+
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj"/>
24+
</ItemGroup>
25+
</Project>
Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
5-
<AssemblyName>Semmle.Autobuild.Shared</AssemblyName>
6-
<RootNamespace>Semmle.Autobuild.Shared</RootNamespace>
7-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8-
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
9-
<Nullable>enable</Nullable>
10-
</PropertyGroup>
11-
12-
<ItemGroup>
13-
<Folder Include="Properties\" />
14-
</ItemGroup>
15-
16-
<ItemGroup>
17-
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
18-
</ItemGroup>
19-
20-
<ItemGroup>
21-
<ProjectReference Include="..\..\extractor\Semmle.Util\Semmle.Util.csproj" />
22-
</ItemGroup>
23-
24-
</Project>
2+
<PropertyGroup>
3+
<TargetFramework>net5.0</TargetFramework>
4+
<AssemblyName>Semmle.Autobuild.Shared</AssemblyName>
5+
<RootNamespace>Semmle.Autobuild.Shared</RootNamespace>
6+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<Folder Include="Properties\"/>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<PackageReference Include="Microsoft.Build" Version="16.11.0"/>
15+
</ItemGroup>
16+
<ItemGroup>
17+
<ProjectReference Include="..\..\extractor\Semmle.Util\Semmle.Util.csproj"/>
18+
</ItemGroup>
19+
</Project>

csharp/extractor/Semmle.Extraction.CIL/Semmle.Extraction.CIL.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
<ItemGroup>
2727
<PackageReference Include="Microsoft.DiaSymReader" Version="1.3.0" />
2828
<PackageReference Include="Microsoft.DiaSymReader.Native" Version="1.7.0" />
29-
<PackageReference Include="Microsoft.DiaSymReader.PortablePdb" Version="1.5.0" />
29+
<PackageReference Include="Microsoft.DiaSymReader.PortablePdb" Version="1.6.0"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
30+
<PrivateAssets>all</PrivateAssets>
31+
</PackageReference>
3032
</ItemGroup>
3133

3234
</Project>
Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
6-
<AssemblyName>Semmle.Extraction.CSharp.Standalone</AssemblyName>
7-
<RootNamespace>Semmle.Extraction.CSharp.Standalone</RootNamespace>
8-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
9-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
10-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
11-
<WarningsAsErrors />
12-
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
13-
<Nullable>enable</Nullable>
14-
</PropertyGroup>
15-
16-
<ItemGroup>
17-
<ProjectReference Include="..\Semmle.Extraction.CSharp\Semmle.Extraction.CSharp.csproj" />
18-
<ProjectReference Include="..\Semmle.Util\Semmle.Util.csproj" />
19-
</ItemGroup>
20-
21-
<ItemGroup>
22-
<Folder Include="Properties\" />
23-
</ItemGroup>
24-
25-
<ItemGroup>
26-
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
27-
<PackageReference Include="Microsoft.Win32.Primitives" Version="4.3.0" />
28-
<PackageReference Include="System.Net.Primitives" Version="4.3.1" />
29-
<PackageReference Include="System.Security.Principal" Version="4.3.0" />
30-
<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0" />
31-
</ItemGroup>
32-
33-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<AssemblyName>Semmle.Extraction.CSharp.Standalone</AssemblyName>
6+
<RootNamespace>Semmle.Extraction.CSharp.Standalone</RootNamespace>
7+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
10+
<WarningsAsErrors/>
11+
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
12+
<Nullable>enable</Nullable>
13+
</PropertyGroup>
14+
<ItemGroup>
15+
<ProjectReference Include="..\Semmle.Extraction.CSharp\Semmle.Extraction.CSharp.csproj"/>
16+
<ProjectReference Include="..\Semmle.Util\Semmle.Util.csproj"/>
17+
</ItemGroup>
18+
<ItemGroup>
19+
<Folder Include="Properties\"/>
20+
</ItemGroup>
21+
<ItemGroup>
22+
<PackageReference Include="Microsoft.Build" Version="16.11.0"/>
23+
<PackageReference Include="Microsoft.Win32.Primitives" Version="4.3.0"/>
24+
<PackageReference Include="System.Net.Primitives" Version="4.3.1"/>
25+
<PackageReference Include="System.Security.Principal" Version="4.3.0"/>
26+
<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0"/>
27+
</ItemGroup>
28+
</Project>

csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Lambda.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ protected override void PopulateExpression(TextWriter trapFile) { }
1818
private void VisitParameter(ParameterSyntax p)
1919
{
2020
var symbol = Context.GetModel(p).GetDeclaredSymbol(p)!;
21+
Context.CacheLambdaParameterSymbol(symbol, p);
2122
Parameter.Create(Context, symbol, this);
2223
}
2324

csharp/extractor/Semmle.Extraction.CSharp/Entities/Parameter.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,17 @@ private Kind ParamKind
5555
}
5656
}
5757

58-
public static Parameter Create(Context cx, IParameterSymbol param, IEntity parent, Parameter? original = null) =>
59-
ParameterFactory.Instance.CreateEntity(cx, param, (param, parent, original));
58+
public static Parameter Create(Context cx, IParameterSymbol param, IEntity parent, Parameter? original = null)
59+
{
60+
var cachedSymbol = cx.GetPossiblyCachedParameterSymbol(param);
61+
return ParameterFactory.Instance.CreateEntity(cx, cachedSymbol, (cachedSymbol, parent, original));
62+
}
6063

61-
public static Parameter Create(Context cx, IParameterSymbol param) =>
62-
ParameterFactory.Instance.CreateEntity(cx, param, (param, null, null));
64+
public static Parameter Create(Context cx, IParameterSymbol param)
65+
{
66+
var cachedSymbol = cx.GetPossiblyCachedParameterSymbol(param);
67+
return ParameterFactory.Instance.CreateEntity(cx, cachedSymbol, (cachedSymbol, null, null));
68+
}
6369

6470
public override void WriteId(EscapingTextWriter trapFile)
6571
{

csharp/extractor/Semmle.Extraction.CSharp/Extractor/Context.cs

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,56 @@ internal class Context : Extraction.Context
1818
/// </summary>
1919
public SemanticModel GetModel(SyntaxNode node)
2020
{
21-
// todo: when this context belongs to a SourceScope, the syntax tree can be retrieved from the scope, and
22-
// the node parameter could be removed. Is there any case when we pass in a node that's not from the current
23-
// tree?
24-
if (cachedModel is null || node.SyntaxTree != cachedModel.SyntaxTree)
21+
if (node.SyntaxTree == SourceTree)
2522
{
26-
cachedModel = Compilation.GetSemanticModel(node.SyntaxTree);
23+
if (cachedModelForTree is null)
24+
{
25+
cachedModelForTree = Compilation.GetSemanticModel(node.SyntaxTree);
26+
}
27+
28+
return cachedModelForTree;
2729
}
2830

29-
return cachedModel;
31+
if (cachedModelForOtherTrees is null || node.SyntaxTree != cachedModelForOtherTrees.SyntaxTree)
32+
{
33+
cachedModelForOtherTrees = Compilation.GetSemanticModel(node.SyntaxTree);
34+
}
35+
36+
return cachedModelForOtherTrees;
37+
}
38+
39+
private SemanticModel? cachedModelForTree;
40+
private SemanticModel? cachedModelForOtherTrees;
41+
42+
// The below is a workaround to the bug reported in https://github.com/dotnet/roslyn/issues/58226
43+
// Lambda parameters that are equal according to `SymbolEqualityComparer.Default`, might have different
44+
// hash-codes, and as a result might not be found in `symbolEntityCache` by hash-code lookup.
45+
internal IParameterSymbol GetPossiblyCachedParameterSymbol(IParameterSymbol param)
46+
{
47+
if ((param.ContainingSymbol as IMethodSymbol)?.MethodKind != MethodKind.AnonymousFunction)
48+
{
49+
return param;
50+
}
51+
52+
foreach (var sr in param.DeclaringSyntaxReferences)
53+
{
54+
var syntax = sr.GetSyntax();
55+
if (lambdaParameterCache.TryGetValue(syntax, out var cached) &&
56+
SymbolEqualityComparer.Default.Equals(param, cached))
57+
{
58+
return cached;
59+
}
60+
}
61+
62+
return param;
63+
}
64+
65+
internal void CacheLambdaParameterSymbol(IParameterSymbol param, SyntaxNode syntax)
66+
{
67+
lambdaParameterCache[syntax] = param;
3068
}
3169

32-
private SemanticModel? cachedModel;
70+
private readonly Dictionary<SyntaxNode, IParameterSymbol> lambdaParameterCache = new Dictionary<SyntaxNode, IParameterSymbol>();
3371

3472
/// <summary>
3573
/// The current compilation unit.
Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
5-
<AssemblyName>Semmle.Extraction.CSharp</AssemblyName>
6-
<RootNamespace>Semmle.Extraction.CSharp</RootNamespace>
7-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9-
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
10-
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
11-
<Nullable>enable</Nullable>
12-
</PropertyGroup>
13-
14-
<ItemGroup>
15-
<ProjectReference Include="..\Semmle.Extraction.CIL\Semmle.Extraction.CIL.csproj" />
16-
<ProjectReference Include="..\Semmle.Extraction\Semmle.Extraction.csproj" />
17-
<ProjectReference Include="..\Semmle.Util\Semmle.Util.csproj" />
18-
</ItemGroup>
19-
20-
<ItemGroup>
21-
<Folder Include="Properties\" />
22-
</ItemGroup>
23-
24-
<ItemGroup>
25-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" />
26-
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
27-
</ItemGroup>
28-
29-
</Project>
2+
<PropertyGroup>
3+
<TargetFramework>net5.0</TargetFramework>
4+
<AssemblyName>Semmle.Extraction.CSharp</AssemblyName>
5+
<RootNamespace>Semmle.Extraction.CSharp</RootNamespace>
6+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8+
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
9+
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
10+
<Nullable>enable</Nullable>
11+
</PropertyGroup>
12+
<ItemGroup>
13+
<ProjectReference Include="..\Semmle.Extraction.CIL\Semmle.Extraction.CIL.csproj"/>
14+
<ProjectReference Include="..\Semmle.Extraction\Semmle.Extraction.csproj"/>
15+
<ProjectReference Include="..\Semmle.Util\Semmle.Util.csproj"/>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<Folder Include="Properties\"/>
19+
</ItemGroup>
20+
<ItemGroup>
21+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1"/>
22+
<PackageReference Include="Microsoft.Build" Version="16.11.0"/>
23+
</ItemGroup>
24+
</Project>

0 commit comments

Comments
 (0)