Bug 6529 - Mono can not compile code calling native functions
Summary: Mono can not compile code calling native functions
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-08-14 12:40 UTC by Maurício Linhares
Modified: 2012-08-16 06:55 UTC (History)
1 user (show)

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

Class that can't be compiled. (997 bytes, application/octet-stream)
2012-08-14 12:40 UTC, Maurício Linhares

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 Maurício Linhares 2012-08-14 12:40:57 UTC
Created attachment 2345 [details]
Class that can't be compiled.

When I try co compile the attached code the compiler crashes with the following output - https://gist.github.com/3350045#file_compiler_output.log

Couldn't get an answer on the mailing list and since this happens even in a blank project (that contains this class alone) I guess it looks like a ocmpiler bug.

I´m running the following mono:

Mono JIT compiler version 2.10.9 (tarball Mon May  7 20:25:51 EDT 2012)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       normal
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          debugger softdebug 
	LLVM:          yes(2.9svn-mono)
	GC:            Included Boehm (with typed GC)

On Lion.
Comment 1 Maurício Linhares 2012-08-14 12:59:48 UTC
Adding the following namespace:

using System.Runtime.InteropServices;

Fixed the issue, the compiler doesn't crash anymore. The compiler should just say that DLLImport is missing instead of crashing in this case.
Comment 2 Marek Safar 2012-08-16 06:55:26 UTC
Fixed in master