Mono-D icon indicating copy to clipboard operation
Mono-D copied to clipboard

Not having a main method in a Unittest build crashes Xamarin

Open Jebbs opened this issue 11 years ago • 5 comments

Just updated to the latest Xamarin beta, and I am using the latest D plug-in.

I was doing some unit test stuff and Xamarin kept crashing. At first I thought it happened when any errors are caught, but I noticed that if I don't provide a main method or use the -main switch, then Xamarin will crash if you try to do a unittest build.

Extra info:

This happened on Win 7, haven't checked if it happens on Linux or Mac, but I can get back to you about those later if you'd like.

Jebbs avatar Jun 29 '14 02:06 Jebbs

Could you elaborate 'crash' a bit more, please?

aBothe avatar Jun 29 '14 02:06 aBothe

Xamarin will attempt to build, but it never succeeds. After a while, a window pops up saying that Xamarin encountered a fatal error and it freezes. Sometimes it will tell me that Xamarin has stopped working and then I force close it, sometimes I just have to force close it manually.

Jebbs avatar Jun 29 '14 02:06 Jebbs

Are you able to get a few bits from the unittest output log or from some other logs available via the Tools->Open Log directory menu? Are you trying to handle a dub project or a normal project? I've tried unittesting a normal 'executable' project and everything worked properly, also without a main method whereas there's a new command variable $main now available for the unittest rdmd command - it'll be filled with the main flag given in the text field below the command option, or with some empty string if no method couldn't be found in the current D source file. Okay, I might extend the 'main' method recognition by checking the project type for being non-executable by default.

aBothe avatar Jun 29 '14 12:06 aBothe

Well, when it tried to build, I received undefined symbol errors for just about everything, then at the end of those it gives me the OPTLINK : Warning 134: No Start Address error.

The fatal error is apparently an out of memory error. I have a couple of these in my log, but they more or less look like this: ERROR [2014-06-29 10:41:47Z]: An unhandled exception has occured. Terminating MonoDevelop? False System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

Jebbs avatar Jun 29 '14 17:06 Jebbs

A...leak!? What the hell. I suppose that rdmd isn't getting all arguments required to build the entire project -- so things like extra arguments etc. are missing. Hmm. Here we are at discussing how to invoke rdmd again :-/

aBothe avatar Jun 29 '14 17:06 aBothe