Bug 7652 - Incorrect redundancy warnings in source analysis
Summary: Incorrect redundancy warnings in source analysis
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: 4.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-10-04 17:01 UTC by Mikayla Hutchinson [MSFT]
Modified: 2012-10-11 08:19 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Mikayla Hutchinson [MSFT] 2012-10-04 17:01:44 UTC
In the following example, source analysis incorrectly warns that " = null" and "errorDetail = ex;" is redundant.

static void Test ()
	Exception errorDetail = null;
	try {
		DoSomething ();
	} catch (Exception ex) {
		errorDetail = ex;
	SomethingElse (errorDetail);
Comment 1 Mikayla Hutchinson [MSFT] 2012-10-04 17:21:47 UTC
Also, in the following code, it incorrectly marks "= null" as redundant.

static void Foo ()
	string s = null;
	try {
		s = Console.ReadLine ();
	} catch {
	Console.WriteLine (s);
Comment 2 Mike Krüger 2012-10-08 03:57:53 UTC
@light: can you take a look at that ?
Comment 3 Mansheng 2012-10-11 06:21:26 UTC
It seems both issues were introduced by the hack you added last time.
I'm looking for a way to resolve this
Comment 4 Mike Krüger 2012-10-11 07:04:30 UTC
Shame on me ! :)
Comment 5 Mansheng 2012-10-11 07:47:22 UTC
I think a simple way is just to not collect issues for assignments inside a try block - it's hard to analyze them as they may jump to any catch or finally
On the other hand, we cannot simply remove them from the graph as this will affect the analysis for things before the TryCatch
Comment 6 Mike Krüger 2012-10-11 08:19:18 UTC
Patch merged - y may be the best solution.