Skip to content

Conversation

@darrelmiller
Copy link
Member

No description provided.

try
{
jsonNode = LoadJsonNodesFromYamlDocument(input);
jsonNode = LoadJsonNodesFromYamlDocument(new StreamReader(input)); // Should we leave the stream open?

Check warning

Code scanning / CodeQL

Missing Dispose call on local IDisposable Warning

Disposable 'StreamReader' is created but not disposed.
try
{
jsonNode = LoadJsonNodesFromYamlDocument(input);
jsonNode = LoadJsonNodesFromYamlDocument(new StreamReader(input));

Check warning

Code scanning / CodeQL

Missing Dispose call on local IDisposable Warning

Disposable 'StreamReader' is created but not disposed.
return ParseAsync(input, reader, format, settings).GetAwaiter().GetResult();
#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits
// Copy string into MemoryStream
var stream = new MemoryStream(Encoding.UTF8.GetBytes(input));

Check warning

Code scanning / CodeQL

Missing Dispose call on local IDisposable Warning

Disposable 'MemoryStream' is created but not disposed.
settings ??= new OpenApiReaderSettings();
using var reader = new StringReader(input);
return Load<T>(reader, version, out diagnostic, format, settings);
var stream = new MemoryStream(Encoding.UTF8.GetBytes(input));

Check warning

Code scanning / CodeQL

Missing Dispose call on local IDisposable Warning

Disposable 'MemoryStream' is created but not disposed.
{
return Load<T>(memoryStream, version, format, out diagnostic, settings);
} else {
memoryStream = new MemoryStream();

Check warning

Code scanning / CodeQL

Missing Dispose call on local IDisposable Warning

Disposable 'MemoryStream' is created but not disposed.
var reader = OpenApiReaderRegistry.GetReader(format);
var readResult = await reader.ReadAsync(input, settings, cancellationToken);

if (settings.LoadExternalRefs)

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
settings
may be null at this access because the parameter has a null default value.
Variable
settings
may be null at this access because the parameter has a null default value.
private static ReadResult InternalLoad(MemoryStream input, string format, OpenApiReaderSettings settings = null)
{
Utils.CheckArgumentNull(format, nameof(format));
if (settings.LoadExternalRefs)

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
settings
may be null at this access because the parameter has a null default value.
Variable
settings
may be null at this access because the parameter has a null default value.
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@baywet baywet merged commit 634cb1c into dev Dec 20, 2024
5 of 10 checks passed
@baywet baywet deleted the darrmi/jsonreaderfix branch December 20, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants