-
Notifications
You must be signed in to change notification settings - Fork 1.5k
rootPathProvider.GetRootPath returns null in FaviconStartup.LocateIconOnFileSystem #624
Comments
I was wondering if you have to provide a RootPathProvider when your tests are in another assembly than the modules when using the Browser object? My bootstrapper just inherits off of DefaultNancyBootstrapper and figured this was handled for me being the super-duper-happy-path after all? ;-) |
@dragan think you could perhaps try this on the latest build (0.12.1) ? Somehow this report slipped through the cracks and I would like to make sure it's still happening in the latest drop before digging into it :) |
@thecodejunkie Sure, give me a bit, pretty busy at the moment with the conference next week. |
@dragan sure thing! Good luck with MonkeySpace! |
This is a problem for me on mono and Nancy.Hosting.Self 0.12.1. |
@thecodejunkie Just tried this with v0.13.0 and it's still happening. |
@dragan is that using the same test as you mention in your initial post? https://gist.github.com/2757624 also what does your |
@thecodejunkie Yes and I'm using the |
I've ran into this issue, running Nancy 0.15.3.0 (downloaded from NuGet) on top of ASP.NET on .NET 4. var browser = new Browser(x => x.RootPathProvider(new DefaultRootPathProvider())); One curious thing - I managed to get the test to run without the code above by inserting some breakpoints and waiting between them but this only worked once and seems unreproducible without breakpoints and with |
Shouldn't be a race condition, we are completely sync and single threaded on startup. |
I've reproduced the bug running with the Nancy solution forked from this repo, once again on top of ASP.NET on .NET 4 and the solution to manually provide a |
I'd love to know what provider.GetType(); is in that case .. I wonder if it's picking up a bad fake or something. |
Nope, the code ends up in public class AspNetRootSourceProvider : IRootPathProvider
{
public string GetRootPath()
{
return HostingEnvironment.MapPath("~/");
}
} HostingEnviroment seems to be uninitialized with everything being null or some other default value. SO says it's because, when testing, we aren't actually running under IIS so Browser should probably initialize the |
Ah, that makes sense then - we have spoken in the past about making a more "intelligent" root path provider for testing, one that actually tries to search for the correct path, but given how test runners copy files all over the shop I'm not sure it will actually work. |
@grumpydev Well, this is a bit above my league (I'm still getting the hang of the codebase) but in the meanwhile, I'll put a warning about this in the Wiki page on testing. |
Encapsulates the "hotfix" for NancyFx#624 as a bootstrapper for testing purposes, "TestingBootstrapper"
Today I submitted #963 #963 which On Thu, Feb 7, 2013 at 2:29 PM, MichaelAz [email protected] wrote:
|
@thecodejunkie I've tested this bug with the latest version of master and this doesn't fix the bug. var providerType = AppDomainAssemblyTypeScanner
.TypesOf<IRootPathProvider>(ScanMode.ExcludeNancy)
.SingleOrDefault();
if (providerType == null)
{
providerType = typeof(DefaultRootPathProvider);
} but in the scenario that triggers this bug I, personally, see two solutions:
I'm personally in favor of option two. |
I thought you said this was only happening while running under a On Sun, Feb 10, 2013 at 9:24 PM, MichaelAz [email protected] wrote:
|
Right, it seems I was testing against the wrong bootstrapper ( |
So if you switch to |
The testing was done against |
Na I think we should leave the docs as is + update the FavIcon scanner to be able to handle the error |
@MichaelAz @dragan could you verify that my last commit fixed it when you use the |
@thecodejunkie seems to work now. Might be worth to check this on Mono, but it's resolved as far as I can see. |
I'm not sure if you get the same result under .NET, but under Mono when running a simple test: https://gist.github.com/2757624
A ArgumentNullException is being thrown. I did a little investigating and sure enough rootPathProvider.GetRootPath() is returning null. Let me know if there's anything else that is needed. Below is the exception information.
The text was updated successfully, but these errors were encountered: