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

RSRP-293560: ReSharper mistakenly identifies code following a COM RCW typecast as "heuristically unreachable"

$
0
0
Reporter Lauri Kotilainen (rytmis) Lauri Kotilainen (rytmis)
Created Apr 10, 2012 12:01:58 PM
Updated Apr 11, 2012 1:16:47 AM
Priority Normal
Type Bug
Fix versions No Fix versions
State Submitted
Assignee Evgeny Pasynkov (pasynkov)
Subsystem Code Analysis
Affected versions 7.0 Preview
Fixed in build No Fixed in build
Given the following code (using DirectShowNet):

var evr = new EnhancedVideoRenderer();
filter = evr as IBaseFilter;
var videoRenderer = filter as IMFVideoRenderer;

if (videoRenderer == null)
throw new Exception("Could not QueryInterface for the IMFVideoRenderer");

ReSharper underlines both 'as' casts, marking them as 'suspicious', then determines that the if condition is always true, and grays out all the code following the if clause saying it's heuristically unreachable. Unfortunately, that's wrong, as the classes in question are COM RCWs, and the casts are actually QueryInterface calls (that succeed at runtime, too).

Viewing all articles
Browse latest Browse all 106942

Trending Articles