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 #15

Merged
merged 3 commits into from
Nov 19, 2013
Merged

Mono Support #15

merged 3 commits into from
Nov 19, 2013

Conversation

aforty
Copy link
Contributor

@aforty aforty commented Nov 16, 2013

It's not pretty...

Two things that are incompatible with Mono:

  • Mono does not implement HostingEnvironment.InClientBuildManager (and has no concept of a build mode afaik)
  • Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule() does not work properly in Mono, for whatever reason

Both are worked around without changing the way the code runs when not on Mono (outside of a few extra conditions).

if (_isRunningMono)
{
HttpModuleActionCollection modules = (WebConfigurationManager.GetWebApplicationSection("system.web/httpModules") as HttpModulesSection).Modules;
modules.Add(new HttpModuleAction(startMethodType.FullName, startMethodType.AssemblyQualifiedName));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know you could do this. Does this work in .NET as well, or only Mono?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not check because I assumed it'd be safer to stick with what was there.

I peeked inside and it seems that DynamicModuleUtility.RegisterModule() then simply invokes System.Web.HttpApplication.RegisterModule(), another method not implemented in Mono.

I'm not sure what the base implementation in HttpApplication is but whatever it is, it currently works in .NET. Best to stick with that.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I was just curious. BTW, the reason I'm calling DynamicModuleUtility.RegisterModule() instead of HttpApplication.RegisterModule() is that the former existed in earlier versions of the framework (4.0 vs 4.5 I think), so it gives great compat.

@aforty
Copy link
Contributor Author

aforty commented Nov 18, 2013

Totally right, my problem was that I was attempting to compile in Mono so thus the reflection.

@davidebbo
Copy link
Owner

I see. Ok, I'll try to make that change on my end in the next couple days.

@davidebbo
Copy link
Owner

Oh, I just realized you did it already! I'll find the time to do basic verification and get that in soon. Thanks!

@davidebbo davidebbo merged commit bdfd748 into davidebbo:master Nov 19, 2013
@davidebbo
Copy link
Owner

Ok, change is in, and pushed to NuGet as version 2.0.4. Thanks for your contribution!

@aforty
Copy link
Contributor Author

aforty commented Nov 19, 2013

Awesome, glad to have helped!

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

Successfully merging this pull request may close these issues.

2 participants