Skip to content

Commit a7916e4

Browse files
authored
Add Encoder.Convert(ReadOnlySpan<char>, Span<byte>) polyfill (#564)
Polyfills the span-based Encoder.Convert overload (introduced in netcoreapp2.1/netstandard2.1) for older targets, with unsafe pointer and safe array-based variants. The safe fallback matches BCL semantics exactly rather than using StringStream's input cap, since a general consumer expects exact charsUsed parity. Qualify the unqualified Convert.* calls in Base64Polyfill and EnumPolyfill to System.Convert.* to avoid collision with the new Polyfill.Convert extension method.
1 parent e479ffc commit a7916e4

57 files changed

Lines changed: 582 additions & 165 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apiCount.include.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
**API count: 1020**
1+
**API count: 1021**
22

33
### Per Target Framework
44

55
| Target | APIs |
66
| -- | -- |
7-
| `net461` | 967 |
8-
| `net462` | 967 |
9-
| `net47` | 966 |
10-
| `net471` | 965 |
11-
| `net472` | 961 |
12-
| `net48` | 961 |
13-
| `net481` | 961 |
14-
| `netstandard2.0` | 963 |
7+
| `net461` | 968 |
8+
| `net462` | 968 |
9+
| `net47` | 967 |
10+
| `net471` | 966 |
11+
| `net472` | 962 |
12+
| `net48` | 962 |
13+
| `net481` | 962 |
14+
| `netstandard2.0` | 964 |
1515
| `netstandard2.1` | 815 |
16-
| `netcoreapp2.0` | 884 |
16+
| `netcoreapp2.0` | 885 |
1717
| `netcoreapp2.1` | 826 |
1818
| `netcoreapp2.2` | 826 |
1919
| `netcoreapp3.0` | 773 |
@@ -25,4 +25,4 @@
2525
| `net9.0` | 183 |
2626
| `net10.0` | 130 |
2727
| `net11.0` | 62 |
28-
| `uap10.0` | 953 |
28+
| `uap10.0` | 954 |

api_list.include.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@
297297
* `bool TryParse(string?, IFormatProvider?, double)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.double.tryparse?view=net-11.0#system-double-tryparse(system-string-system-iformatprovider-system-double@))
298298

299299

300+
#### Encoder
301+
302+
* `void Convert(ReadOnlySpan<char>, Span<byte>, bool, int, int, bool)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.text.encoder.convert?view=net-11.0#system-text-encoder-convert(system-readonlyspan((system-char))-system-span((system-byte))-system-boolean-system-int32@-system-int32@-system-boolean@))
303+
304+
300305
#### Encoding
301306

302307
* `int GetByteCount(ReadOnlySpan<char>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.text.encoding.getbytecount?view=net-11.0#system-text-encoding-getbytecount(system-readonlyspan((system-char))))

assemblySize.include.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
| | Empty Assembly | With Polyfill | Diff | Ensure | ArgumentExceptions | StringInterpolation | Nullability |
44
|----------------|----------------|---------------|-----------|-----------|--------------------|---------------------|-------------|
5-
| netstandard2.0 | 8.0KB | 351.5KB | +343.5KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB |
5+
| netstandard2.0 | 8.0KB | 351.5KB | +343.5KB | +9.5KB | +6.5KB | +9.5KB | +14.0KB |
66
| netstandard2.1 | 8.5KB | 306.0KB | +297.5KB | +8.5KB | +6.0KB | +9.0KB | +13.5KB |
7-
| net461 | 8.5KB | 350.0KB | +341.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB |
8-
| net462 | 7.0KB | 353.5KB | +346.5KB | +9.0KB | +6.5KB | +9.5KB | +13.5KB |
9-
| net47 | 7.0KB | 353.5KB | +346.5KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB |
10-
| net471 | 8.5KB | 352.5KB | +344.0KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB |
11-
| net472 | 8.5KB | 351.5KB | +343.0KB | +9.0KB | +6.0KB | +9.0KB | +13.5KB |
12-
| net48 | 8.5KB | 351.5KB | +343.0KB | +9.0KB | +6.0KB | +9.0KB | +13.5KB |
13-
| net481 | 8.5KB | 351.5KB | +343.0KB | +9.0KB | +6.0KB | +9.0KB | +13.5KB |
7+
| net461 | 8.5KB | 350.5KB | +342.0KB | +9.0KB | +6.0KB | +9.0KB | +13.5KB |
8+
| net462 | 7.0KB | 354.0KB | +347.0KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB |
9+
| net47 | 7.0KB | 353.5KB | +346.5KB | +9.0KB | +6.5KB | +9.5KB | +13.5KB |
10+
| net471 | 8.5KB | 353.0KB | +344.5KB | +9.0KB | +6.0KB | +9.0KB | +13.5KB |
11+
| net472 | 8.5KB | 351.5KB | +343.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB |
12+
| net48 | 8.5KB | 351.5KB | +343.0KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB |
13+
| net481 | 8.5KB | 351.5KB | +343.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB |
1414
| netcoreapp2.0 | 9.0KB | 327.5KB | +318.5KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB |
1515
| netcoreapp2.1 | 9.0KB | 308.0KB | +299.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB |
1616
| netcoreapp2.2 | 9.0KB | 308.0KB | +299.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB |
@@ -29,16 +29,16 @@
2929

3030
| | Empty Assembly | With Polyfill | Diff | Ensure | ArgumentExceptions | StringInterpolation | Nullability |
3131
|----------------|----------------|---------------|-----------|-----------|--------------------|---------------------|-------------|
32-
| netstandard2.0 | 8.0KB | 513.0KB | +505.0KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB |
32+
| netstandard2.0 | 8.0KB | 513.4KB | +505.4KB | +17.2KB | +8.2KB | +14.4KB | +19.4KB |
3333
| netstandard2.1 | 8.5KB | 441.7KB | +433.2KB | +16.2KB | +7.7KB | +13.9KB | +18.9KB |
34-
| net461 | 8.5KB | 512.5KB | +504.0KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB |
35-
| net462 | 7.0KB | 516.0KB | +509.0KB | +16.7KB | +8.2KB | +14.4KB | +18.9KB |
36-
| net47 | 7.0KB | 515.8KB | +508.8KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB |
37-
| net471 | 8.5KB | 514.4KB | +505.9KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB |
38-
| net472 | 8.5KB | 512.4KB | +503.9KB | +16.7KB | +7.7KB | +13.9KB | +18.9KB |
39-
| net48 | 8.5KB | 512.4KB | +503.9KB | +16.7KB | +7.7KB | +13.9KB | +18.9KB |
40-
| net481 | 8.5KB | 512.4KB | +503.9KB | +16.7KB | +7.7KB | +13.9KB | +18.9KB |
41-
| netcoreapp2.0 | 9.0KB | 478.4KB | +469.4KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB |
34+
| net461 | 8.5KB | 513.5KB | +505.0KB | +16.7KB | +7.7KB | +13.9KB | +18.9KB |
35+
| net462 | 7.0KB | 517.0KB | +510.0KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB |
36+
| net47 | 7.0KB | 516.2KB | +509.2KB | +16.7KB | +8.2KB | +14.4KB | +18.9KB |
37+
| net471 | 8.5KB | 515.4KB | +506.9KB | +16.7KB | +7.7KB | +13.9KB | +18.9KB |
38+
| net472 | 8.5KB | 512.8KB | +504.3KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB |
39+
| net48 | 8.5KB | 512.8KB | +504.3KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB |
40+
| net481 | 8.5KB | 512.8KB | +504.3KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB |
41+
| netcoreapp2.0 | 9.0KB | 478.9KB | +469.9KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB |
4242
| netcoreapp2.1 | 9.0KB | 447.4KB | +438.4KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB |
4343
| netcoreapp2.2 | 9.0KB | 447.4KB | +438.4KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB |
4444
| netcoreapp3.0 | 9.5KB | 431.6KB | +422.1KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB |

0 commit comments

Comments
 (0)