[Mono-bugs] [Bug 67149][Maj] New - Bad error message with DllImport when you don't use System.Runtime.InteropServices

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 29 Sep 2004 16:07:08 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by joeshaw@novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=67149

--- shadow/67149	2004-09-29 16:07:08.000000000 -0400
+++ shadow/67149.tmp.17216	2004-09-29 16:07:08.000000000 -0400
@@ -0,0 +1,35 @@
+Bug#: 67149
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: joeshaw@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Bad error message with DllImport when you don't use System.Runtime.InteropServices
+
+Using Mono 1.0.1, if you have code similar to this:
+
+[DllImport ("libwnck-1")]
+extern static IntPtr wnck_screen_get_default ();
+
+and you don't have a "using System.Runtime.InteropServices;", mcs will give
+you the following error:
+
+./FocusTracker.cs(19) error CS0626: Method, operator, or accessor
+'Dashboard.WnckScreen.wnck_screen_get_default()' is marked external and has
+no attributes on it. Consider adding a DllImport attribute to specify the
+external implementation
+
+which is very confusing because I *do* have the DllImport statement there,
+and I get no error saying that DllImportAttribute couldn't be found.  I
+spent maybe 20 minutes trying to figure out what was going on before it
+dawned on me to add the using statement.