Skip to content

Use SequencePoint when reporting missing resource errors#8

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-issue-7
Draft

Use SequencePoint when reporting missing resource errors#8
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-issue-7

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 19, 2026

When a required resource name is missing from the resource file, WriteError was called with only the message string, losing source location context. Fody's WriteError(string, SequencePoint) overload associates the error with a specific point in source, enabling IDEs and build output to navigate directly to the offending member.

Changes

  • Dictionary<string, SequencePoint?> replaces HashSet<string> for requiredResourceNames — maps each resource name to the sequence point of the member that requires it
  • GetSequencePoint(IMemberDefinition) — new helper that extracts the first SequencePoint from a property's getter/setter debug info; returns null for fields or when no PDB data is present
  • UpdateValidationAttribute — now receives the IMemberDefinition and stores the extracted SequencePoint alongside the resource name
  • EnsureRequiredResourceNamesExistInResourceFile — calls WriteError(message, sequencePoint) when a sequence point is available, falls back to WriteError(message) otherwise
private static SequencePoint? GetSequencePoint(IMemberDefinition memberDefinition)
{
    MethodDefinition? method = null;
    if (memberDefinition is PropertyDefinition property)
        method = property.GetMethod ?? property.SetMethod;

    return method?.DebugInformation?.SequencePoints?.FirstOrDefault();
}

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Fix issue 7 Use SequencePoint when reporting missing resource errors Mar 19, 2026
Copilot AI requested a review from mrpmorris March 19, 2026 11:03
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