Skip to main content

Practice · 3 of 3

Diagnostic scan

CHALLENGE
Difficulty: advanced+25 XP

Implement static List<string> CompilerWarnings(string source): compile the source as a library and return the IDs (d.Id) of all WARNING-severity diagnostics (no errors expected in the given inputs), deduplicated and sorted. Example input that warns: "public class A { public int X; }" — CS0169 (unused field) only appears when the field is private and never used; public fields do not warn, so use "public class A { int y; }" for the warning case.

Back to lesson: Practice: Roslyn drills