Skip to content

Conversation

@potatoqualitee
Copy link
Member

Summary

Fixes #9684

Wrapped JobServer.Refresh() calls in foreach loops with null checks to prevent "You cannot call a method on a null-valued expression" errors when:

  • No Agent Operators exist on primary
  • No Agent Proxies exist on primary
  • Agent service is unavailable on secondary replicas

Changes

  • AgentCategory: Added foreach loop with JobServer null check (lines 290-296)
  • AgentOperator: Added foreach loop with JobServer null check (lines 302-306)
  • AgentProxy: Added foreach loop with JobServer null check (lines 317-321)
  • AgentSchedule: Added foreach loop with JobServer null check (lines 327-333)

This follows the same pattern used for DatabaseOwner sync (line 256) and prevents one secondary's issues from blocking the entire sync operation.

Generated with Claude Code

…pty Agent objects

Fixes #9684

Wrapped JobServer.Refresh() calls in foreach loops with null checks to prevent
"You cannot call a method on a null-valued expression" errors when:
- No Agent Operators exist on primary
- No Agent Proxies exist on primary
- Agent service is unavailable on secondary replicas

Changes:
- AgentCategory: Added foreach loop with JobServer null check (lines 290-296)
- AgentOperator: Added foreach loop with JobServer null check (lines 302-306)
- AgentProxy: Added foreach loop with JobServer null check (lines 317-321)
- AgentSchedule: Added foreach loop with JobServer null check (lines 327-333)

This follows the same pattern used for DatabaseOwner sync (line 256) and
prevents one secondary's issues from blocking the entire sync operation.

Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Chrissy LeMaire <potatoqualitee@users.noreply.github.com>
@potatoqualitee potatoqualitee merged commit 4ecaf99 into development Oct 28, 2025
15 checks passed
@potatoqualitee potatoqualitee deleted the claude/issue-9684-20251027-2349 branch October 28, 2025 12:06
@potatoqualitee
Copy link
Member Author

nice fix 👍🏼

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.

Sync-DbaAvailabilityGroup creates unnecessary errors for empty result sub modules

1 participant