Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

Systematic fix of null reference hazards, unsafe null-forgiving operators, and missing validation across the codebase.

Core Library

  • RefitterCodeGenerator.cs: GetOutputFilePath returned invalid path "\Output.cs" when workingDirectory was null
  • StringExtensions.cs: GetDescription<T> accessed memInfo[0] without bounds check
  • CSharpFileMerger.cs: Directory.GetParent() can return null; removed unsafe ! operators
  • PathProvider.cs: programFiles.Replace() called without null guard after GetFolderPath which can return empty
  • DependencyInstaller.cs: Kiota version mismatch had empty TODO block; now calls UpdateKiotaTool() with exception handling
  • FileDownloader.cs: MoveFile silently failed; now logs warning and returns temp file as fallback
  • NpmHelper.cs: string prefix = null! caused issues in callback; use empty string
  • KiotaCodeGenerator.cs, OpenApiCSharpCodeGenerator.cs, NSwagStudioCodeGenerator.cs: Multiple unsafe Path.GetDirectoryName()! patterns replaced with proper fallbacks

CLI

  • JMeterCommand.cs: Unsafe Path.GetDirectoryName()! on user input
  • OpenApiGeneratorCommand.cs: Missing null check for factory parameter (inconsistent with other params)

VSCode Extension

  • version-utils.ts: Number() produces NaN for invalid version parts; use parseInt with fallback to 0
// Before
var workingDirectory = Path.GetDirectoryName(inputFile);
processLauncher.Start(command, arguments, Path.GetDirectoryName(nswagStudioFile)!);

// After  
var workingDirectory = Path.GetDirectoryName(inputFile) ?? Directory.GetCurrentDirectory();
processLauncher.Start(command, arguments, workingDirectory);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • azuresdkartifacts.blob.core.windows.net
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/apiclientcodegen/apiclientcodegen/test/GeneratedCode/GeneratedCode.slnx --packages /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/apiclientcodegen/apiclientcodegen/test/GeneratedCode/AutoRest-V3/Net462/Net462.csproj --packages /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/apiclientcodegen/apiclientcodegen/test/GeneratedCode/AutoRest-V3/Net6/Net6.csproj --packages /home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/apiclientcodegen/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • petstore.swagger.io
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.deps.json /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/testhost.dll --port 39809 --endpoint 127.0.0.1:039809 --role client --parentprocessid 4139 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.deps.json /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/testhost.dll --port 40715 --endpoint 127.0.0.1:040715 --role client --parentprocessid 4266 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/ApiClientCodeGen.Core.Tests.deps.json /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/Core/ApiClientCodeGen.Core.Tests/bin/Debug/net8.0/testhost.dll --port 44921 --endpoint 127.0.0.1:044921 --role client --parentprocessid 5512 --telemetryoptedin false (dns block)
  • westeurope-5.in.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/CLI/ApiClientCodeGen.CLI/bin/Debug/net8.0/rapicgen /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/CLI/ApiClientCodeGen.CLI/bin/Debug/net8.0/rapicgen csharp nswag Swagger.json GeneratedCode /tmp/test-output.cs (dns block)
    • Triggering command: /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/CLI/ApiClientCodeGen.CLI/bin/Debug/net8.0/rapicgen /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/CLI/ApiClientCodeGen.CLI/bin/Debug/net8.0/rapicgen csharp nswag Swagger.json GeneratedCode /tmp/test-output2.cs 076534-d89btt.tx-d p/bin/git (dns block)
    • Triggering command: /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/CLI/ApiClientCodeGen.CLI/bin/Debug/net8.0/rapicgen /home/REDACTED/work/apiclientcodegen/apiclientcodegen/src/CLI/ApiClientCodeGen.CLI/bin/Debug/net8.0/rapicgen csharp nswag Swagger.json GeneratedCode /tmp/final-test.cs credential.username bash (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Find and fix bugs and issues in this repository. Be as thorough as possible


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 30, 2026 22:18
Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bugs and issues in the repository Fix null reference bugs and unsafe code patterns across codebase Jan 30, 2026
Copilot AI requested a review from christianhelle January 30, 2026 22:35
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