spectre.console
spectre.console copied to clipboard
InferSharp static analysis results: Resource leaks and thread safety violations
Information
- OS: Windows
- Version: N/A
- Terminal: N/A
Describe the bug The bugs are found by InferSharp static analysis tool.
#0
/_/src/Spectre.Console/AnsiConsoleFactory.cs:16: error: Dotnet Resource Leak
Leaked resource (output of Spectre.Console.Internal.DefaultExclusivityMode::.ctor() at Line 62).Spectre.Console.Internal.DefaultExclusivityMode._semaphore of type System.Threading.SemaphoreSlim in method "IAnsiConsole AnsiConsoleFactory.Create(AnsiConsoleSettings)".
#1
/_/src/Spectre.Console/Cli/Internal/Configuration/TemplateTokenizer.cs:7: error: Dotnet Resource Leak
Leaked resource buffer of type Spectre.Console.Cli.TextBuffer in method "IReadOnlyList`1<!0> TemplateTokenizer.Tokenize(String)".
#2
/_/src/Spectre.Console/Cli/Internal/Parsing/CommandTreeTokenizer.cs:26: error: Dotnet Resource Leak
Leaked resource previousReader.Spectre.Console.Cli.TextBuffer._reader of type System.IO.StringReader in method "CommandTreeTokenizer$CommandTreeTokenizerResult CommandTreeTokenizer.Tokenize(IEnumerable`1<!0>)".
#3
/_/src/Spectre.Console/Extensions/StringExtensions.cs:37: error: Dotnet Resource Leak
Leaked resource tokenizer of type Spectre.Console.MarkupTokenizer in method "String StringExtensions.RemoveMarkup(String)".
#4
/_/src/Spectre.Console/Internal/Text/Markup/MarkupParser.cs:7: error: Dotnet Resource Leak
Leaked resource tokenizer of type Spectre.Console.MarkupTokenizer in method "Paragraph MarkupParser.Parse(String,Style)".
#5
/_/src/Spectre.Console/Live/LiveRenderable.cs:12: warning: Thread Safety Violation
Read/Write race. Non-private method `LiveRenderable.get_Target()` reads without synchronization from `this.Spectre.Console.Rendering.LiveRenderable._renderable`. Potentially races with write in method `LiveRenderable.SetRenderable(...)`.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
#6
/_/src/Spectre.Console/Live/LiveRenderable.cs:16: warning: Thread Safety Violation
Read/Write race. Non-private method `LiveRenderable.get_HasRenderable()` reads without synchronization from `this.Spectre.Console.Rendering.LiveRenderable._renderable`. Potentially races with write in method `LiveRenderable.SetRenderable(...)`.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
#7
/_/src/Spectre.Console/Live/Progress/Columns/SpinnerColumn.cs:25: warning: Thread Safety Violation
Read/Write race. Non-private method `SpinnerColumn.get_Spinner()` reads without synchronization from `this.Spectre.Console.SpinnerColumn._spinner`. Potentially races with write in method `SpinnerColumn.set_Spinner(...)`.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
#8
/_/src/Spectre.Console/Live/Progress/Columns/SpinnerColumn.cs:46: warning: Thread Safety Violation
Unprotected write. Non-private method `SpinnerColumn.set_CompletedText(...)` writes to field `this.Spectre.Console.SpinnerColumn._maxWidth` outside of synchronization.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
#9
/_/src/Spectre.Console/Live/Progress/Columns/SpinnerColumn.cs:60: warning: Thread Safety Violation
Unprotected write. Non-private method `SpinnerColumn.set_PendingText(...)` writes to field `this.Spectre.Console.SpinnerColumn._maxWidth` outside of synchronization.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
#10
/_/src/Spectre.Console/Live/Progress/ProgressTask.cs:50: warning: Thread Safety Violation
Read/Write race. Non-private method `ProgressTask.get_StartTime()` reads without synchronization from `this.Spectre.Console.ProgressTask.<StartTime>k__BackingField`. Potentially races with write in method `ProgressTask.StopTask()`.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
#11
/_/src/Spectre.Console/Live/Progress/ProgressTask.cs:55: warning: Thread Safety Violation
Read/Write race. Non-private method `ProgressTask.get_StopTime()` reads without synchronization from `this.Spectre.Console.ProgressTask.<StopTime>k__BackingField`. Potentially races with write in method `ProgressTask.StopTask()`.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
#12
/_/src/Spectre.Console/Live/Progress/ProgressTask.cs:65: warning: Thread Safety Violation
Read/Write race. Non-private method `ProgressTask.get_IsStarted()` indirectly reads without synchronization from `this.Spectre.Console.ProgressTask.<StartTime>k__BackingField`. Potentially races with write in method `ProgressTask.StopTask()`.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
#13
/_/src/Spectre.Console/Live/Progress/ProgressTask.cs:70: warning: Thread Safety Violation
Read/Write race. Non-private method `ProgressTask.get_IsFinished()` indirectly reads without synchronization from `this.Spectre.Console.ProgressTask.<StopTime>k__BackingField`. Potentially races with write in method `ProgressTask.StopTask()`.
Reporting because another access to the same memory occurs on a background thread, although this access may not.
Found 14 issues
Issue Type(ISSUED_TYPE_ID): #
Thread Safety Violation(THREAD_SAFETY_VIOLATION): 9
Dotnet Resource Leak(DOTNET_RESOURCE_LEAK): 5
Screenhots
Below you can find the Microsoft Sarif Viewer screenshot with attached result.sarif file uploaded within report.zip:

Please upvote :+1: this issue if you are interested in it.