Bug 8231 - comments in source file result in incorrect syntax error line number
Summary: comments in source file result in incorrect syntax error line number
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-11-05 16:52 UTC by troy-dawson
Modified: 2012-11-06 08:37 UTC (History)
3 users (show)

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

Incorrect highlighted line number (238.17 KB, image/png)
2012-11-05 16:52 UTC, troy-dawson

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 GitHub or Developer Community 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 troy-dawson 2012-11-05 16:52:57 UTC
Created attachment 2869 [details]
Incorrect highlighted line number

Syntax error line highlighting is confused by comments, both // and /**/

To replicate, using the Mac Mono sample AnimatingViews, inducing a syntax error below the comment block results in wrong reported number:

See attached screenshot.

Version information:

MonoDevelop 3.0.5
Installation UUID: 6a2a8221-3b03-4767-baac-18d2cce46447
	Mono 2.10.9 (tarball)
	GTK 2.24.10
	GTK# (
	Package version: 210090011
Apple Developer Tools:
	 Xcode 4.5.2 (1847)
	 Build 4G2008a
Mono for Android: Not Installed

Monotouch: 6.0.6 (Evaluation)
Build information:
	Release ID: 30005000
	Git revision: e159cf083bd327933166819d94245298898d6e3d
	Build date: 2012-10-24 16:43:06+0000
	Xamarin addins: eea2ed91ae8dd242b281d5ec8f6c2fbc63b4cd3d
Operating System:
	Mac OS X 10.8.2
	Darwin troys-MacBook-Pro.local 12.2.0 Darwin Kernel Version 12.2.0
	    Sat Aug 25 00:48:52 PDT 2012
	    root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
Comment 1 troy-dawson 2012-11-05 16:55:06 UTC
(deleting the comment block results in correct highlighting behavior)
Comment 2 Mike Krüger 2012-11-06 01:14:33 UTC
Can't reproduce it  - but it sounds more like a compiler error.

Can you give us the build output ?
(Click on build output in the error list)

There is the compiler message - I get:

/Users/mkrueger/monomac/samples/AnimatingViews/Main.cs(18,39): error CS0117: `MonoMac.AppKit.NSApplication' does not contain a definition for `InitXXXX'

I bet that you get (15,39) there instead
Comment 3 troy-dawson 2012-11-06 01:26:24 UTC

/Users/troy/Downloads/monomac-master/samples/AnimatingViews/Main.cs(15,39): error CS0117: `MonoMac.AppKit.NSApplication' does not contain a definition for `InitXXXXX'

when modifying the original source file with the comment block.
Comment 4 troy-dawson 2012-11-06 01:33:32 UTC
Oddly, changing the comment block to 	/**/
results in correct line determination (line 15), but changing /**/ to // results in the line being off by one again:

/Users/troy/Downloads/monomac-master/samples/AnimatingViews/Main.cs(14,39): error CS0117: `MonoMac.AppKit.NSApplication' does not contain a definition for `InitXXXXX'
Comment 5 Mike Krüger 2012-11-06 04:55:33 UTC
Mareks: Do you've an idea about that ? It odes work on my machine. But I'm using a newer mono version.
Comment 6 troy-dawson 2012-11-06 07:39:06 UTC
This issue is indeed not showing up in 3.0.0 mcs output -- 3.0.0 + MonoDevelop is functioning correctly.
Comment 7 Mike Krüger 2012-11-06 08:37:13 UTC
Ok then I mark it as fixed - I think the next release will work