Skip to content

Commit ff5845e

Browse files
author
Ron Petrusha
authored
DeflateStream decompression app compat issue (microsoft#563)
* DeflateStream decompression app compat issue * Addressed review comments, fixed typos, removed remarks * Addressed additional comments
1 parent 3fdf1e7 commit ff5845e

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## DeflateStream uses native APIs for decompression
2+
3+
### Scope
4+
Minor
5+
6+
### Version Introduced
7+
4.7.2
8+
9+
### Source Analyzer Status
10+
NotPlanned
11+
12+
### Change Description
13+
14+
Starting with the .NET Framework 4.7.2, the implementation of decompression in the `T:System.IO.Compression.DeflateStream` class has changed to use native Windows APIs by default. This results in an average performance improvement of approximately 300%. All .NET applications running on machines with versions of the .NET Framework starting with version 4.7.2 will now use the native implementation.
15+
16+
This change might result in some differences in behavior, which include:
17+
18+
- Exception messages may be different. However, the type of exception thrown remains the same.
19+
20+
- Some special situations, such as not having enough memory to complete an operation, may be handled differently.
21+
22+
- [X] Quirked
23+
- [ ] Build-time break
24+
25+
### Recommended Action
26+
27+
If decompression with native APIs has adversely affected the behavior of your app, you can opt out of this feature by adding the `Switch.System.IO.Compression.DoNotUseNativeZipLibraryForDecompression` switch to the `runtime` section of your app.config file and setting it to `true`:
28+
29+
```xml
30+
<?xml version="1.0" encoding="utf-8" ?>
31+
<configuration>
32+
<runtime>
33+
<AppContextSwitchOverrides
34+
value="Switch.System.IO.Compression.DoNotUseNativeZipLibraryForDecompression=true" />
35+
</runtime>
36+
</configuration>
37+
```
38+
### Affected APIs
39+
`T:System.IO.Compression.DeflateStream`
40+
`T:System.IO.Compression.GZipStream`
41+
42+
### Category
43+
Core
44+
45+
<!--
46+
#518398
47+
-->
48+
49+

0 commit comments

Comments
 (0)