Bug 14450 - False positive of "Virtual member call in constructor"
Summary: False positive of "Virtual member call in constructor"
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Windows
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-09-05 02:16 UTC by Lopatkin Ilja
Modified: 2014-03-27 06:31 UTC (History)
2 users (show)

Tags:
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:
Status:
VERIFIED FIXED

Description Lopatkin Ilja 2013-09-05 02:16:15 UTC
Here's an example class:

public class Test {
    public Test(Action action) {
        action();
    }
}

Invocation of the "action" instance is considered as a virtual method call which is wrong, I guess.
The same thing goes to Func instances too, but not for delegates.
Comment 1 Mike Krüger 2013-09-05 03:58:26 UTC
fixed
Comment 2 Sadik Ali 2014-03-27 06:31:25 UTC
I have verified this issue and noticed that "action" instance is not considered as a virtual method. 

I followed below steps:

1. Created console project.
2. added new Test class
3. implement code mentioned in bug description.

Screen cast: http://screencast.com/t/2CYg3yRrL

Let me know if I am missing anything to check this issue.

Build Info:

=== Xamarin Studio ===
Version 4.2.4 (build 266)
Installation UUID: 400bab6b-f5cd-4e84-a1d1-39f9d6414cb1
Runtime:
 Microsoft .NET 4.0.30319.18449
 GTK+ 2.24.22 (MS-Windows theme)
 GTK# 2.12.25


=== Build Information ===
Release ID: 402040266
Git revision: 57fa6b7639703775ae1d5c46536e42ab424cb177
Build date: 2014-03-20 12:27:02-04
Xamarin addins: eee141c29724a19529e77b8e743086d95b29f5ba

=== Operating System ===
Windows 6.2.9200.0 (64-bit)