what is so bad about GC.KeepAlive() that FxCop flags this as a violation?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Probably because it’s considered bad practice to be calling it, just like it’s a generally a bad idea to call
GC.Collect— it has generally negative consequences on the collector and/or is a possible indication of a design flaw on your end.You should be able to reconfigured FxCop to not consider calls to the method a problem if you need to call it, however. There are valid reasons to do so, after all.