Bug 316141 (MONO67149) - Bad error message with DllImport when you don't use System.Runtime.InteropServices
Summary: Bad error message with DllImport when you don't use System.Runtime.InteropSer...
Status: RESOLVED MOVED
Alias: MONO67149
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Major
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-29 23:07 UTC by Joe Shaw
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:55:05 UTC


---- Reported by joeshaw@novell.com 2004-09-29 16:07:08 MST ----

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.



---- Additional Comments From duncan@ximian.com 2004-09-29 16:25:17 MST ----

With csc 8.00.40607.42 (came with C# Express, should be the same as
beta-1), the error shown is:

c:\src\test.cs(5,3): error CS0246: The type or namespace name
'DllImport' could not be found (are you missing a using directive or
an assembly reference?)



---- Additional Comments From jluke@cfl.rr.com 2004-09-29 17:05:44 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO60997 ***


Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"