Search code examples
xamlresharpersuppress-warnings

Resharper: how to suppress warning "Field xy is never used" in XAML


I want to suppress a warning in my xaml file. I applied the corresponding quick fix option to "Disable once warning by comment". However, the warning is still active. How do I correctly suppress the warning? I would like to keep the name because it tells something about the purpose of the element. (An alternative would be to remove the name and use a comment.) enter image description here

Edit

  • The issue is only valid vor Resharper version Build 8.2.0.2160.
  • After updating to 8.2.3 the suppression works correctly. (And in version 9 the warning does not seem to be active by default.) Thanks to citizenmatt.
  • The issue is still shown in the Inspection Results view, see related question Resharper: How to hide suppressed warnings in Inspection Results?
  • In this special case it makes more sense to use the Tag attribute (thanks to Mike Eason) or to use a comment to write the name instead of using a comment to suppress the warning.

Solution

  • This looks like an issue with an older version of ReSharper. You can update to the latest version of 8.x (8.2.3) or ReSharper 9 (the 9.2 EAP has just released EAP3). It appears to have fixed the issue.