Skip to content

Commit 8d6b835

Browse files
authored
Merge pull request github#5316 from tamasvajk/feature/roslyn3.9
C#: Upgrade Roslyn dependencies to 3.9
2 parents 86b933a + 3e0245a commit 8d6b835

File tree

10 files changed

+22
-20
lines changed

10 files changed

+22
-20
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Semmle.Extraction.CSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</ItemGroup>
2323

2424
<ItemGroup>
25-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" />
25+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" />
2626
</ItemGroup>
2727

2828
</Project>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.8.0" />
18+
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.9.0" />
1919
<PackageReference Include="GitInfo" Version="2.0.20">
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
<PrivateAssets>all</PrivateAssets>

csharp/ql/test/library-tests/controlflow/guards/Assert.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Diagnostics;
33
using Microsoft.VisualStudio.TestTools.UnitTesting;
4-
4+
#nullable enable
55
class AssertTests
66
{
77
void M1(bool b)

csharp/ql/test/library-tests/controlflow/guards/Collections.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Collections.Generic;
55
using System.Collections.Specialized;
66
using System.Linq;
7-
7+
#nullable enable
88
public class Collections
99
{
1010
void M1(string[] args)

csharp/ql/test/library-tests/controlflow/guards/Guards.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
2+
#nullable enable
33
public class Guards
44
{
55
public string? Field;

csharp/ql/test/library-tests/controlflow/guards/Splitting.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22
using System.Diagnostics;
3-
3+
#nullable enable
44
/// <summary>
55
/// Tests related to CFG splitting.
66
/// </summary>

csharp/ql/test/library-tests/csharp8/NullableRefTypes.expected

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ returnTypes
207207
| NullableRefTypes.cs:215:10:215:20 | ElementTest | Void! |
208208
| NullableRefTypes.cs:223:48:223:54 | GetSelf | TestNullableFlowStates? |
209209
methodTypeArguments
210-
| NameResolutionSuppressNullable.cs:10:21:10:40 | EnsureInitialized | 0 | WaitCallback? |
210+
| NameResolutionSuppressNullable.cs:10:21:10:40 | EnsureInitialized | 0 | WaitCallback |
211211
| NullableRefTypes.cs:51:12:51:15 | Q | 0 | MyClass! |
212212
| NullableRefTypes.cs:51:12:51:15 | Q | 0 | MyClass? |
213213
| NullableRefTypes.cs:67:10:67:21 | GenericFn | 0 | MyClass! |
@@ -326,11 +326,11 @@ expressionTypes
326326
| NullableRefTypes.cs:113:36:113:43 | access to field Property | MyClass? |
327327
| NullableRefTypes.cs:113:36:113:43 | this access | RefTypes |
328328
| NullableRefTypes.cs:113:36:113:44 | ...! | MyClass? |
329-
| NullableRefTypes.cs:157:18:157:30 | object creation of type MyClass | MyClass! |
330-
| NullableRefTypes.cs:160:17:160:17 | access to local variable a | MyClass! |
331-
| NullableRefTypes.cs:160:17:160:21 | MyClass a = ... | MyClass! |
332-
| NullableRefTypes.cs:160:21:160:21 | access to parameter p | MyClass! |
333-
| NullableRefTypes.cs:161:16:161:16 | access to local variable a | MyClass! |
329+
| NullableRefTypes.cs:157:18:157:30 | object creation of type MyClass | MyClass |
330+
| NullableRefTypes.cs:160:17:160:17 | access to local variable a | MyClass |
331+
| NullableRefTypes.cs:160:17:160:21 | MyClass a = ... | MyClass |
332+
| NullableRefTypes.cs:160:21:160:21 | access to parameter p | MyClass |
333+
| NullableRefTypes.cs:161:16:161:16 | access to local variable a | MyClass |
334334
| NullableRefTypes.cs:181:17:181:17 | access to local variable x | string! |
335335
| NullableRefTypes.cs:181:17:181:31 | String x = ... | string! |
336336
| NullableRefTypes.cs:181:21:181:31 | call to method MaybeNull | string? |
@@ -444,9 +444,6 @@ exprFlowState
444444
| NullableRefTypes.cs:110:64:110:67 | null | Maybe null |
445445
| NullableRefTypes.cs:113:36:113:43 | access to field Property | Not null |
446446
| NullableRefTypes.cs:113:36:113:44 | ...! | Not null |
447-
| NullableRefTypes.cs:157:18:157:30 | object creation of type MyClass | Not null |
448-
| NullableRefTypes.cs:160:21:160:21 | access to parameter p | Not null |
449-
| NullableRefTypes.cs:161:16:161:16 | access to local variable a | Not null |
450447
| NullableRefTypes.cs:181:21:181:31 | call to method MaybeNull | Maybe null |
451448
| NullableRefTypes.cs:183:9:183:16 | call to method Check | Not null |
452449
| NullableRefTypes.cs:183:15:183:15 | access to local variable x | Maybe null |

csharp/ql/test/library-tests/csharp9/record.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import csharp
22

33
query predicate records(Record t, string i, RecordCloneMethod clone) {
4-
t.getABaseInterface().toStringWithTypes() = i and clone = t.getCloneMethod()
4+
t.getABaseInterface().toStringWithTypes() = i and
5+
clone = t.getCloneMethod() and
6+
t.fromSource()
57
}
68

79
private string getMemberName(Member m) {
810
result = m.getDeclaringType().getQualifiedName() + "." + m.toStringWithTypes()
911
}
1012

1113
query predicate members(Record t, string ms, string l) {
14+
t.fromSource() and
1215
exists(Member m | t.hasMember(m) |
1316
ms = getMemberName(m) and
1417
if m.fromSource() then l = m.getLocation().toString() else l = "no location"

csharp/ql/test/query-tests/Security Features/CWE-020/RuntimeChecksBypass.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ public Test1(string v)
1717
[OnDeserializing]
1818
public void Deserialize()
1919
{
20-
f = $"invalid"; // BAD
20+
f = GetString(); // BAD, non-constant and non-object creation expr
2121
}
22+
23+
string GetString() { throw null; }
2224
}
2325

2426
[Serializable]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| RuntimeChecksBypass.cs:20:13:20:22 | $"..." | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:7:19:7:19 | f | f | RuntimeChecksBypass.cs:11:9:14:9 | if (...) ... | check |
2-
| RuntimeChecksBypass.cs:124:15:124:34 | call to method GetInt32 | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:112:16:112:18 | Age | Age | RuntimeChecksBypass.cs:116:9:117:53 | if (...) ... | check |
3-
| RuntimeChecksBypass.cs:168:15:168:17 | access to local variable age | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:153:16:153:18 | Age | Age | RuntimeChecksBypass.cs:157:9:158:53 | if (...) ... | check |
1+
| RuntimeChecksBypass.cs:20:13:20:23 | call to method GetString | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:7:19:7:19 | f | f | RuntimeChecksBypass.cs:11:9:14:9 | if (...) ... | check |
2+
| RuntimeChecksBypass.cs:126:15:126:34 | call to method GetInt32 | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:114:16:114:18 | Age | Age | RuntimeChecksBypass.cs:118:9:119:53 | if (...) ... | check |
3+
| RuntimeChecksBypass.cs:170:15:170:17 | access to local variable age | This write to $@ may be circumventing a $@. | RuntimeChecksBypass.cs:155:16:155:18 | Age | Age | RuntimeChecksBypass.cs:159:9:160:53 | if (...) ... | check |
44
| RuntimeChecksBypassBad.cs:19:15:19:34 | call to method GetInt32 | This write to $@ may be circumventing a $@. | RuntimeChecksBypassBad.cs:7:16:7:18 | Age | Age | RuntimeChecksBypassBad.cs:11:9:12:53 | if (...) ... | check |

0 commit comments

Comments
 (0)