[Mono-dev] Random "Internal Compiler Error" with extension methods on interfaces?

Jordan Earls earlz at lastyearswishes.com
Sun Feb 3 02:37:57 UTC 2013


Hi, I've been messing with extension methods some in my open source
project. I stumbled across an internal compiler error. The full
message is this:

/home/earlz/Projects/barelymvc/BarelyMVC.Tests/Caching/CacheTest.cs(15,57):
error CS0584: Internal compiler error: Array index is out of range.
/home/earlz/Projects/barelymvc/BarelyMVC.Tests/Caching/CacheTest.cs(15,40):
error CS1928: Type `Earlz.BarelyMVC.Caching.ICacheMechanism' does not
contain a member `Setup' and the best extension method overload
`Earlz.BarelyMVC.Caching.CacheExtensions.Setup(this
Earlz.BarelyMVC.Caching.ICacheMechanism, string,
Earlz.BarelyMVC.Caching.CacheInfo)' has some invalid arguments
/home/earlz/Projects/barelymvc/BarelyMVC/bin/Debug/BarelyMVC.dll
(Location of the symbol related to previous error)

The error line looks like this:

			static TestCache()
			{
				Cacher.Setup("Testfoo", new CacheInfo()); //error here
			}
			public static ICacheMechanism Cacher=new MockCacheMechanism();

The implementation of Setup looks like this:

		public static void Setup(this ICacheMechanism cacher, string name,
CacheInfo info)
		{
			cacher.KeyInfo.Add(name, info);
		}

Obviously, this shouldn't cause a compiler error. I've tried to
reproduce it in a small test case, but I couldn't. My project is open
source though, so I could give a full solution file and point to where
the error happens

This happens on Arch linux x86-64. All packages are up to date and
`mono --version`:

[earlz at EarlzAlpha ~]$ mono --version
Mono JIT compiler version 2.10.8 (tarball Sat Oct  6 23:22:30 UTC 2012)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors.
www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

I've tried compiling the git version of mono in the past but it's a
bit more... challenging than I expected, so I'm not sure I'll be able
to repro this with latest.

What should I do? Report a bug with a huge repro?

If anyone wants to see the bug in action, extract
http://earlz.net/static/repro.tgz
Then, open the solution file in Monodevelop and try to compile the
BarelyMVC.Tests project. You should get the error on line 15 of
CacheTest.cs (please disregard the terrible code quality, it was a bit
of an experiment :) )

Thanks,
Jordan


More information about the Mono-devel-list mailing list