Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mono support for Castle Core #79

Closed
jonorossi opened this issue Jan 16, 2015 · 10 comments
Closed

Mono support for Castle Core #79

jonorossi opened this issue Jan 16, 2015 · 10 comments
Milestone

Comments

@jonorossi
Copy link
Member

Over the last month I've spent a little bit of time trying to get our build set up working well for Mono, so that I could look into #72 knowing any new unit tests would then be running on our CI server.

This issue follows on from a thread on the mailing list which didn't yield any results.

So far I've:

  • Fixed a bunch of small issues (e.g. b320a57, 8cf8c3c, e33c78b)
  • Removed the really old Mono 2.6 and 2.8 configurations and replaced them with a Mono 3.10 for now (7654511).
  • Changed the way we run unit tests on Mono (4234289).
  • Attempted to fix unit tests failing on Mono on Linux but not OSX with errors like "Missing method .ctor in assembly ..., type ExtensionAttribute" (86df41f, 3080c4c).

I'm now stuck with these strange missing constructor errors. It seems Mono on Linux isn't liking the NLog and Serilog assemblies. Following is the error message running unit tests on Mono 3.10 on the Ubuntu TeamCity agent:

Missing method .ctor in assembly /home/teamcity/buildagent/work/16de7b8c88ab14af/lib/net45/NLog.dll, type System.Runtime.CompilerServices.ExtensionAttribute
Can't find custom attr constructor image: /home/teamcity/buildagent/work/16de7b8c88ab14af/lib/net45/NLog.dll mtoken: 0x0a000018

(http://builds.castleproject.org/viewType.html?buildTypeId=Core_MasterMono310)

I've read mentions that this type of error is caused by the fact ExtensionAttribute moved assembly between .NET 4.0 and 4.5 via a TypeForwardedTo, but I'm trying to avoid building log4net, NLog and Serilog from source in our build.

I'd like if we can remove the MONO310 build configuration completely and compile using the NET45 one. The only reason I've kept it for now is so I could easily switch between using lib/net40 and lib/net45 binaries without affecting anything else. You'll see that I've disabled the MONO define by renaming it so all that conditional code is built on Mono.

@kkozmic
Copy link
Contributor

kkozmic commented Apr 10, 2015

Any update on that?

@jonorossi
Copy link
Member Author

I haven't had a chance to get back to it, however James has been making some progress. I'll try to find some time to upgrade the TeamCity Linux agent to Mono 3.12.1 and give it another look.

@kkozmic
Copy link
Contributor

kkozmic commented Apr 10, 2015

Ok no worries

On Fri, 10 Apr 2015 12:45 Jonathon Rossi notifications@github.com wrote:

I haven't had a chance to get back to it, however James has been making
some progress
https://groups.google.com/forum/#!topic/castle-project-devel/3dk5lb_GOtw.
I'll try to find some time to upgrade the TeamCity Linux agent to Mono
3.12.1 and give it another look.


Reply to this email directly or view it on GitHub
#79 (comment).

@jonorossi jonorossi added this to the v3.4 milestone Jun 22, 2015
@jonorossi
Copy link
Member Author

I've made a heap of progress on mono support. I've got everything building without Castle.Core.dll being conditionally compiled using our NET45-Release configuration, however Castle.Core.Tests.dll is conditionally compiled to handle slight differences and ignore failing and crashing unit tests for now.

The branch is mono-support and the builds are available at http://builds.castleproject.org/project.html?projectId=Core.

@jonorossi
Copy link
Member Author

I reinstalled our Mono Linux build agent the other day which resolved the Missing method .ctor in assembly problems, I suspect the upgrade of Mono from 3.12 to 4.0.1 didn't quite work right last time.

I've still got some more work to do and then I'll post another update about what is left before is in a good state, but the build output now should be no worse than it was before. The main thing to note at the moment is that some #if __MonoCS__ conditional compilation is masking some defects (including mono runtime crashes) because I'm ignoring a bunch of unit tests (1389 - 1253 = 136 extra tests ignored), but now with a clean/green build we can go back and fix each one separately.

@floydpink
Copy link

Great stuff, Jono. 👍

What is the development setup you're using for Mac/Linux? I am trying to use Xamarin/MonoDevelop, but since the project being built from the command-line build is different from the main project/solution, I have been seeing some differences in the build/test from within the IDE.

@jonorossi
Copy link
Member Author

@floydpink just using Atom+Terminal.app on Mac and Vim on Linux. No OmniSharp, but I might look at that later. I also tried Xamarin Studio a few months ago and it didn't handle the conditional references and stuff that we've got in the csproj files so I gave up with it. Will probably need to look at it again, what differences are you seeing?

@floydpink
Copy link

When trying to build NET45-Debug or NET45-Release configurations from within Xamarin on Mac after opening Castle.Core.sln, these things have to be done for the build to be successful:

  1. Add the missing project reference to Castle.Services.Logging.log4netIntegration to Castle.Core.Tests project
  2. Disable the compiler setting of Treat warnings as errors for the Castle.Core.Tests project

But even after the solution starts building, the Unit Tests pad/pane within Xamarin does not show any of the tests within the solution.

All of these could be Xamarin Studio nuances - I haven't spent enough time yet on these.

@jonorossi
Copy link
Member Author

@floydpink I've logged a separate issue to sort out Xamarin Studio (#93)

I've also logged #94 to track fixing the remaining unit tests, feel free to help with any of them.

@jonorossi
Copy link
Member Author

I merged my mono-support branches a year ago and things are in a pretty good state, however there are still some known issues. I'm closing this issue as there isn't anymore to do at an overall level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants