Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-182108: QFix on Unresolved Variable: "Use Existing Variable" N/A

$
0
0
Reporter Serge Baltic (baltic) Serge Baltic (baltic)
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.

        /// <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);
            }
        }

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>