CodeGeneration.Tests FAIL
Closed this issue · 4 comments
Simple.Web.CodeGeneration.Tests.HandlerRunnerBuilderTest.CallsPatchWithParameter [FAIL]
Simple.Web.UnsupportedMediaTypeException : Requested type(s) not available
Stack Trace:
c:\Source\GitHub\Simple.Web\Simple.Web\Behaviors\Implementations\SetInput.cs(45,0): at Simple.Web.Behaviors.Implementations.GetInput.Impl[T](IContext context)
at lambda_method(Closure , Object , IContext )
c:\Source\GitHub\Simple.Web\Tests\Simple.Web.CodeGeneration.Tests\HandlerRunnerBuilderTest.cs(75,0): at Simple.Web.CodeGeneration.Tests.HandlerRunnerBuilderTest.CallsPatchWithParameter()
Yes, I've been getting this. It appears to be a race condition or
something. Works fine if you run it individually. Under investigation.
On Aug 30, 2012 8:17 PM, "Ian Battersby" notifications@github.com wrote:
Simple.Web.CodeGeneration.Tests.HandlerRunnerBuilderTest.CallsPatchWithParameter [FAIL]
Simple.Web.UnsupportedMediaTypeException : Requested type(s) not available
Stack Trace:
c:\Source\GitHub\Simple.Web\Simple.Web\Behaviors\Implementations\SetInput.cs(45,0): at Simple.Web.Behaviors.Implementations.GetInput.Impl[T](IContext context)
at lambda_method(Closure , Object , IContext )
c:\Source\GitHub\Simple.Web\Tests\Simple.Web.CodeGeneration.Tests\HandlerRunnerBuilderTest.cs(75,0): at Simple.Web.CodeGeneration.Tests.HandlerRunnerBuilderTest.CallsPatchWithParameter()—
Reply to this email directly or view it on GitHubhttps://github.com//issues/27.
Interestingly this seems to be around AppDomain.CurrentDomain.GetAssemblies()
(ExportedTypeHelper) consistently returning the appropriate IMediaTypeHandler
. If you manually add the Type after the scan, it works every time, so perhaps it's not a straight-forward race-condition after all?
Hacky spike:-
private static void PopulateContentTypeHandlerFunctions()
{
foreach (var exportedType in ExportedTypeHelper.FromCurrentAppDomain(TypeIsContentTypeHandler))
{
AddContentTypeHandler(exportedType);
}
AddContentTypeHandler(System.Reflection.Assembly.LoadFrom("..\\..\\..\\..\\Simple.Web.JsonFx\\bin\\debug\\Simple.Web.JsonFx.dll").GetExportedTypes().FirstOrDefault(x => x.Name == "JsonMediaTypeHandler"));
AddContentTypeHandler(typeof(FormDeserializer));
}
Adding to my comment above, I'm not sure with this kind of type scanning if some kind of start-up object graph generation (via IoC container or otherwise) might be an option?
Decided the answers not in the box, it's in the band ;-)