Bug 23920 - Incorrect highlighting/hints about false positive errors in complex solutions.
Summary: Incorrect highlighting/hints about false positive errors in complex solutions.
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: David Karlaš
URL:
Depends on:
Blocks:
 
Reported: 2014-10-18 19:02 UTC by Brian Berry
Modified: 2017-07-28 14:19 UTC (History)
7 users (show)

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


Attachments
Partial screenshot showing the observed false positives. (102.58 KB, image/png)
2014-10-18 19:10 UTC, Brian Berry
Details
Screenshot of the syntax highlight (782.37 KB, image/png)
2015-12-31 17:37 UTC, francis.toupin
Details


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:
RESOLVED NOT_REPRODUCIBLE

Description Brian Berry 2014-10-18 19:02:35 UTC
Observed:  Incorrect error/warning highlighting and code completion
with nontrivial solutions.

Steps to reproduce:  None yet, but I'll be looking for some as time allows,
as this is becoming a constant nuisance.

XS 5.6.2 (build 5) currently, though I do not believe the issue to be
specific to that version.

Notes:

The issue appears to be that, in a solution with mixed targets including
shared projects, I routinely see the IDE incorrectly mark up code as
invalid (and lose the ability to perform code completion / etc.) with
code that is definitely valid.  In an example snipped:

using System;
using Xamarin.Forms;

namespace Bootstrap
{
    public class Root : ContentPage
    {
        public Root()
        {
            BackgroundColor = Color.FromRgb(128,64,0);

            var testView = new View()
            {
                WidthRequest = 100,
                HeightRequest = 250,
                BackgroundColor = Color.FromRgb(64,0,0)
            };
            . . . 

The Xamarin.Forms portion of the using (and all Xamarin.Forms types
and fields beneath) are in red with an observed basic root cause as
if the IDE does not think that Xamarin.Forms is a valid assembly for
the project.

The project *does* have the X.F package installed and the assemblies
are indeed referenced.  A mouseover of "Xamarin" at top shows a
tooltip of CS0103 (name does not exist in the current context)
and a mouseover of "Forms" shows a tooltip of "?".

The related project builds fine.  NOTE (!!): If I inject a simple
compile-time error anywhere within the file and build, the error
wakes up or otherwise causes XS to refresh its config/code senses
such that all of the erroneous highlighting goes away (and proper
code completion / lookups / etc. resume).

This means that I am constantly having to inject simple errors
in files I am editing just to get XS back to its senses, so that
further editing in the same module can be accomplished without
the huge productivity penalty that the erroneous indications
and absence of code completion incur.

I also observe currently that quitting the IDE and reloading it
results in the same module having incorrect indications, though
the project with the proper setup (including Xamarin.Forms) remains
untouched.  So a clean load of the solution/projects also do not
get things to the correct state to begin with.

So there is some kind of sickness with IDE sense of project
configuration/state/whatever.

Note that this looks similar to 18091, though an iOS project in
this case (though I don't think my issues are iOS-specific).
Comment 1 Brian Berry 2014-10-18 19:10:31 UTC
Created attachment 8449 [details]
Partial screenshot showing the observed false positives.

Partial screenshot showing the state of the IDE after
initial project load.

Note the referenced assemblies are correct.
Note that a build of the project does not resolve the issue.

Note that introduction of a stray character (or any error)
followed by a build of the project results in the removal
of all false positives from the file (and the correct errors
apparent for the intentionally-introduced error).
Comment 2 Brian Berry 2014-10-19 11:11:59 UTC
Additional note:  while 18091 shows the same high level symptoms (incorrect highlighting), in my case closing the file and reopening it does not result in corrections.   Building successfully does not result in corrections.   Introduction of an error (why, I have no idea) is what it takes to get the IDE to refresh its view of the file given the current config.
Comment 3 Brian Berry 2014-10-19 12:26:13 UTC
Additional note:  In my observed case (fixed by introducing an error in the module), double-clicking the file in the solution explorer (even though the file is already open) puts it back into the false positive error condition.  This file is within a shared project, FWIW.
Comment 4 Parmendra Kumar 2014-10-20 06:31:51 UTC
I have checked this issue but I am not able to reproduce this issue, I have observed that if I have create a Xamarin.Forms shared project. All package load successfully.
Please checked the screencast and let me know if I missed anything.

Screencast: http://www.screencast.com/t/CmuA9qSqoTNz

Environment Info:
=== Xamarin Studio ===

Version 5.6.2 (build 5)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
Runtime:
	Mono 3.10.0 ((detached/e204655)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000023

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.iOS ===

Version: 8.2.0.209 (Business Edition)
Hash: 1d986ba
Branch: 
Build date: 2014-10-17 23:37:23-0400

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: /Users/360_macmini/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.10.0.13 (Business Edition)

=== Build Information ===

Release ID: 506020005
Git revision: 19bc3b64b70332bfab18faf9cf1ce7d3aa191b36
Build date: 2014-10-17 14:49:01-04

=== Operating System ===

Mac OS X 10.9.4
Darwin ShrutiMac.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 5 Mike Krüger 2014-10-23 00:55:39 UTC
Looks like the document 'lost' it's project - the shared project <--> document mapping code is the likely cause.
Comment 6 francis.toupin 2015-12-31 17:34:44 UTC
I also happen to have the same problem with Xamarin Studio. The IDE highlights as error some parts of my code that compile/work well.

I'm developing in C#, on MacOS version : OS X 10.11.2 (15C50)

My Xamarin's build version is : 5.10.1 (Build 6).

If that can be any useful, the code base I'm working on is at https://github.com/topinfrassi01/GraphTheories

It's annoying to a point I'd like to be able to remove the errors highlight.

If there's anything else I can link to help, please let me know,
Comment 7 francis.toupin 2015-12-31 17:37:35 UTC
Created attachment 14422 [details]
Screenshot of the syntax highlight
Comment 8 Parmendra Kumar 2016-01-05 13:02:24 UTC
I have checked this issue with attached sample project in comment #6 and able to reproduce it.

Screencast: http://www.screencast.com/t/7df12KeF

IDE Log: https://gist.github.com/Parmendrak/390c7fb5bded774fe7d7

Environment Info:

Xamarin Studio  5.10.2 (build 49)
Installation UUID: 05cfbdd7-b4af-41cd-945a-9db8b054b749
Mono 4.2.2 (explicit/11c1351)
GTK+ 2.24.23 (Raleigh theme)
Package version: 402010003
Xamarin.Android: 6.0.1.5 (Enterprise Edition)
Xcode 7.2 (9548)
Xamarin.iOS 9.4.1.15 (Enterprise Edition)
Mac OS X 10.10.5
Comment 9 Cullen Tsering 2016-02-10 16:23:13 UTC
I am seeing the same issue just as described in Comment 8.


Environment:
Xamarin Studio
Version 5.10.2 (build 56)
Runtime:
	Mono 4.2.2 (explicit/996df3c)
	GTK+ 2.24.23 (Raleigh theme)
	Package version: 402020030

Apple Developer Tools
Xcode 7.2.1 (9548.1)
Build 7C1002

Xamarin.iOS
Not Installed

Xamarin.Android
Version: 6.0.1.10 (Business Edition)
Comment 10 jon.se5a 2016-12-28 21:05:31 UTC
Seeing the same thing in MonoDevelop 5.10 on linux mint.
Comment 11 jon.se5a 2016-12-28 21:19:38 UTC
In my case, introduction of an error, then rebuilding does not appear to fix the problem.
Comment 12 Brian Berry 2017-01-14 20:24:52 UTC
Any updates on this?  These kinds of errors remain
in the Visual Studio for Mac prerelease as of today,
renders these projects/solutions basically unmanageable
from an editing/workflow perspective when they are
loaded on the Mac.
Comment 13 David Karlaš 2017-01-17 05:09:08 UTC
First I want to note that we have two problems:
1) Brain(original bug reporter) problem with Xamarin.Forms assembly not added to type system.
2) XS 5 bug that "node" parameter was highlighted as error, which is fixed in XS 6.

This are two unrelated problems, since bug 2) is already fixed I'm going to focus on 1).
So I'm mostly directing questions at Brain here:

1) Is this happening only in one specific solution(Bootstrap) or in any solution?
2) Is this happening only on one specific computer or is it happening also on other with different setups?
3) Is reloading solution still not resolving errors on XS 6(or VSforMac)?(we had some code completion caching in XS 5, I want to know if that was cause for persistence after solution reload).
4) Is this happening only in shared project documents or also in "parent" projects(check in iOS or Android if Xamarin.Forms references work).
5) In top left corner of shared document you can switch between selected project that document is included in. Does changing project change state of errors?
6) How soon after opening solution does this happen? Few minutes or hours? Is it random? Do you have a way to reproduce this?
7) Any idea how I could reproduce this problem?
Comment 14 Brian Berry 2017-01-17 15:51:41 UTC
Let me try and break it down further here locally since it's possible we are conflating multiple issues (made more difficult by the issue being open for 2+ years now.  ;)).  The root cause of my latest response is that I still see improper error highlighting / loss of code completion / etc. in shared project contexts in cases where I do not in the Windows/VS side, making editing on the Mac somewhat useless.

And to be clear, current cases of this locally do not involve Xamarin.Forms at all (that was only an example before).  I see improper false positive errors in other cases.

More if/when I have it.

Thanks.
Comment 15 Lluis Sanchez 2017-06-23 08:58:51 UTC
Does this still happen on VS for Mac?
Comment 16 Jordan Matthiesen [MSFT] 2017-07-28 14:19:08 UTC
Hi, Brian - thanks for bearing with us on this issue after a few years! I'm going to go ahead and resolve this issue now since we aren't able to reproduce it and we haven't heard back for a little over a month. However, if you're still having this problem with the latest Visual Studio for Mac Preview release, please re-open the bug and I'm happy to setup some time for us to talk over Skype and see what's going on here. Thanks!