Skip to content

Commit 5e3b625

Browse files
authored
Merge pull request #1414 from felicity-semmle/1.21/csharp-change-notes
QL 1.21: Finalize change notes for C#
2 parents 64a8daa + fe38417 commit 5e3b625

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

change-notes/1.21/analysis-csharp.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Improvements to C# analysis
22

3+
## General improvements
4+
5+
C# analysis now supports the extraction and analysis of many C# 8 features. For details see [Changes to code extraction](#changes-to-code-extraction) and [Changes to QL libraries](#changes-to-ql-libraries) below.
6+
37
## Changes to existing queries
48

59
| **Query** | **Expected impact** | **Change** |
610
|------------------------------|------------------------|-----------------------------------|
7-
| Class defines a field that uses an ICryptoTransform class in a way that would be unsafe for concurrent threads (`cs/thread-unsafe-icryptotransform-field-in-class`) | Fewer false positive results | The criteria for a result has changed to include nested properties, nested fields and collections. The format of the alert message has changed to highlight the static field. |
8-
| Constant condition (`cs/constant-condition`) | Fewer false positive results | Results have been removed where the `null` value is in a conditional expression on the left hand side of a null-coalescing expression. For example, in `(a ? b : null) ?? c`, `null` is not considered to be a constant condition. |
9-
| Useless upcast (`cs/useless-upcast`) | Fewer false positive results | Results have been removed where the upcast is used to disambiguate the target of a constructor call. |
11+
| Class defines a field that uses an ICryptoTransform class in a way that would be unsafe for concurrent threads (`cs/thread-unsafe-icryptotransform-field-in-class`) | Fewer false positive results | The criteria for a result has changed to include nested properties, nested fields, and collections. The format of the alert message has changed to highlight the static field. |
12+
| Constant condition (`cs/constant-condition`) | Fewer false positive results | The query now ignores code where the `null` value is in a conditional expression on the left hand side of a null-coalescing expression. For example, in `(a ? b : null) ?? c`, `null` is not considered to be a constant condition. |
13+
| Useless upcast (`cs/useless-upcast`) | Fewer false positive results | The query now ignores code where the upcast is used to disambiguate the target of a constructor call. |
1014

1115
## Changes to code extraction
1216

@@ -17,12 +21,12 @@
1721
- `static` modifiers on local functions
1822
- Null-coalescing assignment expressions
1923

20-
* The `unmanaged` type parameter constraint is now extracted.
24+
* The `unmanaged` type parameter constraint is also now extracted.
2125

2226
## Changes to QL libraries
2327

24-
* The class `Attribute` has two new predicates: `getConstructorArgument()` and `getNamedArgument()`. The first predicate returns arguments to the underlying constructor call and the latter returns named arguments for initializing fields and properties.
25-
* The class `TypeParameterConstraints` has a new predicate `hasUnmanagedTypeConstraint()`, indicating that the type parameter has the `unmanaged` constraint.
28+
* The class `Attribute` has two new predicates: `getConstructorArgument()` and `getNamedArgument()`. The first predicate returns arguments to the underlying constructor call and the second returns named arguments for initializing fields and properties.
29+
* The class `TypeParameterConstraints` has a new predicate `hasUnmanagedTypeConstraint()`. This shows whether the type parameter has the `unmanaged` constraint.
2630
* The following QL classes have been added to model C# 8 features:
2731
- Class `AssignCoalesceExpr` models null-coalescing assignment, for example `x ??= y`
2832
- Class `IndexExpr` models from-end index expressions, for example `^1`
@@ -37,5 +41,3 @@
3741
- Class `Switch` models both `SwitchExpr` and `SwitchStmt`
3842
- Class `Case` models both `CaseStmt` and `SwitchCaseExpr`
3943
- Class `UsingStmt` models both `UsingBlockStmt` and `UsingDeclStmt`
40-
41-
## Changes to autobuilder

0 commit comments

Comments
 (0)