-
-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanup projects and environment variables #2812
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
418ce0e
cleanup projects and environment variables
kasperk81 9cc5ff2
add net9.0
kasperk81 56b28fc
net9.0
kasperk81 e6cf1e5
Revert .net9
kasperk81 5f19369
Merge branch 'main' into refactor
JimBobSquarePants 93299e1
Merge branch 'main' into refactor
JimBobSquarePants 87d6f00
Test against NET 9
JimBobSquarePants 62744c6
FIx build
JimBobSquarePants File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RuleSet Name="ImageSharp" ToolsVersion="17.0"> | ||
<Include Path="..\shared-infrastructure\sixlabors.ruleset" Action="Default" /> | ||
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.NetAnalyzers" RuleNamespace="Microsoft.CodeAnalysis.CSharp.NetAnalyzers"> | ||
<Rule Id="CA2022" Action="Info" /> | ||
</Rules> | ||
</RuleSet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my learning, why was this analyzer downgraded from the default
Warning
toInfo
? The issues that this analyzer flags are typically bugs when reading from Streams.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warnings were in areas of our code where it wasn’t really applicable. Our decoders are designed to handle degenerate images and in each warning instance we had pre-allocated an empty buffer to read to. If we don’t get a full read then those buffers remain partially unfillled and the decoding process will return when we look for the next chunk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm wondering if we have a missed use case / bug in our analyzer then. Do you happen to have a link to example code that it flagged? Maybe it just couldn't understand the pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the analyzer will ever be possible to follow the code well enough here.
Take this for example. In
ReadFrame
in the GIF decoder we attempt to read a local color palette from a stream. The analyzer will warn us that we might not get the full read though.ImageSharp/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
Line 432 in 2d7cf48
In this instance we simply do not care as the following method
ReadFrameColors
reads and checks the next byte. If it's invalid then we do nothing.ImageSharp/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
Lines 533 to 534 in 2d7cf48
We also do a sense check and break when performing the next iteration to find additional frames so the decoder will quit after decoding as much information as possible.
ImageSharp/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
Lines 155 to 156 in 2d7cf48
So, our code is safe, we could perhaps break earlier but we would end up complicating the code in order to do so.
Info
will work in our scenarios as it will prompt us to check the code but not inhibit our ability to work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking a quick look, I believe the reason why the code is safe is because
BufferedReadStream
guarantees it will fill out the entire passed in buffer on each call to.Read
.ImageSharp/src/ImageSharp/IO/BufferedReadStream.cs
Lines 176 to 195 in 2d7cf48
ReadToBufferDirectSlow
andReadToBufferViaCopySlow
read from the underlying stream in a loop until it fills the buffer or hits the end of the stream.ImageSharp/src/ImageSharp/IO/BufferedReadStream.cs
Lines 347 to 357 in 2d7cf48
ImageSharp/src/ImageSharp/IO/BufferedReadStream.cs
Lines 320 to 326 in 2d7cf48
ImageSharp/src/ImageSharp/IO/BufferedReadStream.cs
Lines 270 to 288 in 2d7cf48