-
-
Save ToJans/860030 to your computer and use it in GitHub Desktop.
Server Error in '/' Application. | |
Object reference not set to an instance of an object. | |
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. | |
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. | |
Source Error: | |
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. | |
Stack Trace: | |
[NullReferenceException: Object reference not set to an instance of an object.] | |
Simple.Data.SimpleRecord.TryGetMember(GetMemberBinder binder, Object& result) in C:\Projecten\Org.NerdBeers\Dependencies\Simple.Data\Simple.Data\SimpleRecord.cs:48 | |
CallSite.Target(Closure , CallSite , Object ) +130 | |
Org.NerdBeers.Web.Services.Repository.GetBeerEventSubscribers(Int32 id) in d:\temp\rerb1bhw.i0j\input\src\Org.NerdBeers\Org.NerdBeers.Web\Services\Repository.cs:36 | |
Org.NerdBeers.Web.Modules.<>c__DisplayClass74.<.ctor>b__67(Object x) in d:\temp\rerb1bhw.i0j\input\src\Org.NerdBeers\Org.NerdBeers.Web\Modules\BeerEventModule.cs:26 | |
Nancy.Routing.Route.Invoke(DynamicDictionary parameters) in C:\Projecten\Nancy\Nancy\src\Nancy\Routing\Route.cs:29 | |
Nancy.NancyEngine.ResolveAndInvokeRoute(NancyContext context) in C:\Projecten\Nancy\Nancy\src\Nancy\NancyEngine.cs:119 | |
Nancy.NancyEngine.HandleRequest(Request request) in C:\Projecten\Nancy\Nancy\src\Nancy\NancyEngine.cs:85 | |
Nancy.Hosting.Aspnet.NancyHandler.ProcessRequest(HttpContextBase context) in C:\Projecten\Nancy\Nancy\src\Nancy.Hosting.Aspnet\NancyHandler.cs:19 | |
Nancy.Hosting.Aspnet.NancyHttpRequestHandler.ProcessRequest(HttpContext context) in C:\Projecten\Nancy\Nancy\src\Nancy.Hosting.Aspnet\NancyHttpRequestHandler.cs:76 | |
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100 | |
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 |
Throwing mental routes at you: Is HttpContext flowing along? Does Nancy do any callbacks on different threads? Is property "dynamic DB" evaluated as soon as it is accessed, or is there some form of deferred execution going on (ala LINQ enumerable extension methods)? How does SimpleData/SimpleRecord do its method lookup (some kind of cache that is not yet fully built perhaps)?
PRO tip: Add some logging ...
I materialized it in my last commit, just to be sure... ( ToJans/NerdBeers@820b54f )
About the logging, keep in mind that the app was written within this context: http://www.corebvba.be/blog/post/Continuous-thinking-just-ship-it-the-story-of-NerdBeers.aspx
Thanks for the help BTW ;-)
I meant "temporary logging until I found what is causing this exception I don't expect" :)
Hehe, agreed. The repo was initially a singleton, but it was switched to per-request.
@grumpydev explained me the default convention for IOC: classes are per-request and interfaces are singletons.
Hi Tom.
Spent some time on this over lunch, was getting random tests not passing at random points, sometimes. I think I tracked the problem down to my BufferedEnumerable type and its blatant disregard for synchronization. I've added locking to it now, and run the tests several times with no fails. Could you try NB with a build from my latest master and see if the bug goes away? If so I'll push to NuGet as 0.5.2.
Thanks,
Mark
Hey Mark,
Thank you for the quick reaction; I'll try to do it ASAP...
Tom
Threading issue?