Reporter | Justin (McCulty) |
---|---|
Created | Dec 13, 2011 8:41:06 PM |
Updated | Feb 15, 2012 1:55:07 PM |
Resolved | Dec 14, 2011 5:44:25 PM |
Priority | Normal |
Type | Unspecified |
Fix versions | No Fix versions |
State | Won't fix |
Assignee | Evgeny Pasynkov (pasynkov) |
Subsystem | No subsystem |
Affected versions | No Affected versions |
Fixed in build | No Fixed in build |
Consider the following code:
There is a warning created on the use of obj. However I don't think there is anything technically wrong with this. I realize that inside Method it could keep the delegate that was passed in and use it at a later time (after obj has been disposed) but there is no way for R# to know that. For example, R# doesn't complain about the following:
using (obj) { Method(delegate { obj.Something(); }); }
There is a warning created on the use of obj. However I don't think there is anything technically wrong with this. I realize that inside Method it could keep the delegate that was passed in and use it at a later time (after obj has been disposed) but there is no way for R# to know that. For example, R# doesn't complain about the following:
using (obj) { Method(obj); } public void Method(object obj) { // Keep a reference to obj or use it in a separate thread, etc... }