Skip to content

Conversation

@SharaawyMohamed
Copy link

@SharaawyMohamed SharaawyMohamed commented Dec 28, 2025

Fixes #2327

Proposed Changes

  • Converts null service names to empty string
  • Prevents ArgumentNullException when IConfiguration returns null

- Fixes ThreeMammals#2327: Unit test failures with .NET 10.0.100-preview.7
- Converts null service names to empty string
- Prevents ArgumentNullException when IConfiguration returns null
ArgumentNullException.ThrowIfNull(services);
_servicesDelegate = services;
_serviceName = serviceName;
_serviceName = serviceName?? string.Empty;
Copy link
Member

@raman-m raman-m Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, is this really the bug fix? 🤣
It doesn’t seem related to the .NET SDK version. Can it be reproduced in .NET 9?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the CI tests failing when all tests pass successfully on my local machine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't warry, the build is green now. Use "Re-run job" button.

Why are the CI tests failing when all tests pass successfully on my local machine?

Yes, tests pass reliably locally and remain stable in the CI environment. A few CPU-sensitive tests might occasionally fail even on local runs, but overall, the tests are optimized to perform well in both environments.
The fact is, we have many tests in Ocelot Core that run parallel logic and are sensitive to thread synchronization. Syncing threads can be unpredictable, but usually, a simple re-run does the trick.

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 93.503%. remained the same
when pulling 8b62661 on SharaawyMohamed:fix/roundrobin-null-service-name
into 9fc4e78 on ThreeMammals:develop.

@raman-m raman-m changed the title Fix: Handle null service name in RoundRobin constructor #2327 Handle null service name in RoundRobin constructor Jan 1, 2026
@raman-m
Copy link
Member

raman-m commented Jan 1, 2026

Will you hold off on adding the net10.0 TFM to the projects?
The problem now is that it’s impossible to verify if the fix works without the net10.0 TFM.

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.

Unit test failures and ArgumentNullException with .NET 10.0.100-preview.7.25351.101 SDK

3 participants