Reporter |
|
---|---|
Created | Jun 11, 2010 6:46:34 PM |
Updated | Apr 7, 2018 10:59:12 AM |
Resolved | Apr 7, 2018 10:59:12 AM |
Subsystem | Quick Fixes |
Assignee | Alisa Afonina (alisa.afonina) |
Priority | Normal |
State | Obsolete |
Type | Bug |
Fix version | No Fix versions |
Affected versions | No Affected versions |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
Usually if the variable is defined above but within a scope, R# suggests fixing the usage by pulling the var declaration (but not assignment) out of that scope.
A typical example is when you introduce variable under a using clause (eg reading a value from reg key) and want to employ the value after exiting the using scope.
In the below example the QFix is unavailable, but it should be.
A typical example is when you introduce variable under a using clause (eg reading a value from reg key) and want to employ the value after exiting the using scope.
In the below example the QFix is unavailable, but it should be.
/// <summary>
/// Reports the messages to user thru the event.
/// </summary>
private void FlushMessageQueue()
{
for(;;)
{
lock(myQueueMessage)
{
if(myIsCanceled)
myQueueMessage.Clear();
if(myQueueMessage.IsEmpty())
return;
byte[] data = myQueueMessage.Dequeue();
}
if(!myIsCanceled)
userCallBack(data);
}
}