Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: Spring.NET 1.1.1 & Mono 1.9 Problems

  1. #21
    Join Date
    Jul 2007
    Posts
    28

    Default

    Hi Gael,

    Unfortunately Spring.Web is a long way from running on Mono. This is due to the fact that in a large number of places in the spring.web code reflection is used to access private methods and members that are not part of the public API. As these methods or members may or may not exist in Mono, and even if they do they probably won't have the same names, there is a large amount of Mono specific hacking to be done on Spring.Web before it will work. It also means that there will never be a cross platform binary for Spring.Web.

    I started on this a few months ago, however other commitments have meant that I've had to shelve this work for a while. I hope to return to it in the coming months.

    Cheers,
    James

  2. #22
    Mark Pollack is offline Spring.NET Co-Lead Spring TeamSpring User
    Join Date
    Sep 2004
    Location
    New York, NY
    Posts
    1,683

    Default

    Hi,
    Thanks. I put a bit of time into getting things to compile with Mono 2.0 as of Oct 1st 2008. These changes are in subversion. If you get the latest code I think all you should need to do is use the latest version of NAnt and enable the line
    Code:
    <call target="${nant.target.root.name}-mono-2.0" />
    In the nant function "build-all-function". What issues did you run into? I was able to compile the same set of libs as you...except didn't pass the tests.

    I commented out some of the tests where resolution against the serbian culture were failing - not sure what is going on there but I'm pretty confident it is due to the wierdness of that 'culture', so to speak. there were issues in Msoft .NET to get it all to work correctly with serbian, say as compared to french or russian.

    Keep me posted, it would be nice to close this issue as there are many details an iterations to get it all working for some time now.

    Cheers,
    Mark

    You can post relevant tech details on JIRA issue - http://jira.springframework.org/browse/SPRNET-296

  3. #23
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    wrt running Spring.Web on Mono: Most of the reflection hacks deal with intercepting Page/Control instantiation, so that users don't have to worry about it.
    But it should be a no brainer to implement a different DI strategy for Mono like e.g. AutoFac is doing by hooking into the Page.InitComplete event and iterating over all controls on the page at this stage. Of course this does not give the guarantee, but there's still Spring's <spring:Panel> that can be used to enable DI on it's contained controls.

    As far as I remember, there are only 2 other things we need to deal with:

    1)
    The call to HttpRuntime.ProcessRequestNow() in WebSupportModule. This call is necessary to ensure certain initialization is done when using the "ASP.NET Admin" Web from within VS (which uses the questionable System.Web.Administration.* stuff)

    2)
    hooking into the in-memory Session_End event to ensure, that 'session' scoped objects are properly disposed.

    hth,
    Erich

  4. #24
    Join Date
    Apr 2006
    Location
    France - Strasbourg
    Posts
    11

    Default

    Hi,

    Spring.Web works on my system but with some limitations and via local adpatations. I give you this little account of the installation. Hoping this will be useful for your team.

    -----------------------



    Install of Spring.NET 1.2.0 With Mono 1.9.1 on Mandriva 2009.

    1/ Building Spring.NET

    1a/ Install nant
    I used the 0.86 beta version for building

    1b/ Find, build and place libraries
    Mono lirairies are not in the Spring.NET. Find antlr at www.antlr2.org (I used the 2.7.6.2) and Common.Logging at sourceforge.I built them with the config mono 2.0 and place them in Spring.NET12/lib/mono/2.0/. For NHbiernate, add libraries in lib/NHibernate20/mono/2.0

    1c/ Mofidy a file in Spring.Web
    In src/Spring/Spring.Web/Web/Support/InterceptControlCollectionStrategy.cs, lines 142-143 : DynamicMethod take a fourth argument, I gave it 'ownerType' and the code passed at compilation. Other solution, at line 122, add '&& !MONO' to compilator condition.

    1d/ Modify build files
    Spring.include : comment readregistry commands
    Spring.build : comment the readregistry command, comment the sets that you don't want to build (I kept Core, Aop, Web, WebExtensions, Data, Data.NHibernate and Services without examples and without tests).
    There is a readregistry command in spring.services.build to comment.

    1e/ Build
    "nant build-mono-2.0" builds Spring.NET in build/mono/2.0/debug(or release)

    2/ Use of Spring in a simple Web application with XSP2

    2a/ Spring.Web/Spring.Context.Support.WebSupportModule.cs
    line 81 and 151, I needed to add '&& !MONO' to compilator condition because the mono HttpContext doesn't have a HideRequestResponde Field (thanks reflector...)

    2b/ Spring.Web/Spring.Context.Support.WebContextHandler.cs
    the problem is that XSP2 gives a null configContext. Then, In WebContextHandler.GetContextName I added "if (configContext == null) return (String.Empty);" at the begin. It works but children context are not attached at [spring.root], each one is [spring.root], then I must declare all my context at the root of application...

    2c/ Spring.Web/Spring.Web.Support.ControlAccessor.cs
    I commented the delegate for "ClearNamingContainer"(it doesn't exist in mono) and the related code.
    I had to simplify the Controls property ; get just returns _targetControl.Controls ; and set does nothing.

    I rewrote the SetcontroleAt to not use the safeField (the code may be inefficient but works...) :
    public void SetControlAt(Control control, int index)

    {
    Control[] controls = new Control[this.Controls.Count];
    this.Controls.CopyTo(controls, 0);

    controls[index] = control;
    this.Controls.Clear();
    for(Int32 i=0; i < controls.Length; i++)
    this.Controls.Add(controls[i]);
    }

    2d/ Spring.Web/Spring.Web.Support.LocalResourceManager.cs
    It calls different classes that don't exist in mono... I choose to activate the old system in Spring.web.UI.Page, MasterPage and UserControl. Thus there is no class that catch MissingManifestException, I must compile a resource for each page...

    --------------------------------------------------------

    It finally works with some limitations but for my application, this is acceptable.

    Regards
    Gaƫl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •