Freigeben über


Use it or lose it! [New Delay.FxCop code analysis rule helps identify unused resources in a .NET assembly]

**

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments

  • Anonymous
    August 10, 2011
    Is there a way to ignore the *.resx associated to forms and controls which have the Localize property set to True? Thanks

  • Anonymous
    August 12, 2011
    Isawen, I'm not sure which property you're referring to - if you have a link you can share, that might be helpful. That said, RESX files tend to be 1-per-assembly rather than 1-per-control, so I'm not sure how easy it would be to do what you're asking. But more information would definitely be appreciated! :)

  • Anonymous
    August 12, 2011
    The comment has been removed

  • Anonymous
    August 15, 2011
    Isawen, Thank you very much for the clarification - it's been many years since I did Windows Forms development and it sounds like some of the conventions there differ from my more recent WPF/Silverlight experience. The explanation you provide is great and it sounds like this scenario is a definite candidate for improvement. I've updated my TODO list and hope to get to this in the near-ish future!

  • Anonymous
    August 23, 2011
    Hello David, Were you able to improve your FxCop rule to detect the unused strings from resources? Thanks.

  • Anonymous
    August 24, 2011
    Isawen, Not yet, sorry. I haven't been riding the bus to work lately and that's when I do most of the work for my blog. :) I'm hoping things will settle down in a week or two!

  • Anonymous
    August 17, 2012
    Ruleset dll throws an exception when you have a const string set to null for example public const string MyString = null;

  • Anonymous
    August 17, 2012
    Jason, Sorry about that! I've just made a fix and uploaded a new ZIP with the updated code+assembly (the version number is now 1.0.0.2). Please re-download and let me know if that fixes the problem for you. Thanks!

  • Anonymous
    August 20, 2012
    thanks, fixed the problem. one minor bug and one request if it is easy. bug: I don't know what you are filling in for Help URL, but fxcop says "Malformed URL" and if you click the link on the Rule Support tab, it causes fxcop to crash badly. (In truth it is more an fxcop bug since they shouldn't crash like this even if you give a bad url) since you don't actually have a help page for this maybe about:blank would make it not crash. The minor request is on the spell check of literals, can you display the full string? (or at least X chars around the misspelled word) in any case, thanks a bunch. -J

  • Anonymous
    August 20, 2012
    Jason, Thanks for getting back to me! I've added a note to my TODO list for your idea for adding context around misspelled literals. I'll look into the Help URL thing soon because it sounds like it should be a quick enough fix. I'll reply back here with the results (good or bad). I appreciate the feedback - thank you!

  • Anonymous
    August 21, 2012
    Jason, I've made a tweak to populate the URL field of each rule with a link to this blog. :) I've uploaded a new ZIP with the updated code+assembly (version number 1.0.0.3) - please give it a try. Thanks again for your help!