Okay, looks like I'm going to be "that guy".
-1
I don't have an issue with adding a signature to the OWIN spec (I think that's good), but I'm not a huge fan of this signature, by itself, for a very specific reason.
Let me explain:Obviously as one of the founders of Glimpse I think and care a lot about diagnostics. For example, we've been able to build this middleware visualization on top of Katana:
Technically we are able to pull this off because IAppBuilder's Use(object middleware, params object[] args) method gives us the ability to figure out the type associated with the middleware. Some string manipulation gets us friendly names like "Custom Trace", and boom, Bob's your uncle.
My fear is that standardizing on Func<AppFunc, AppFunc> will result in builder implementations simply leveraging that signature for Use() methods as well (e.g. IXBuilder.Use(Func<AppFunc, AppFunc> func)) . Func<AppFunc, AppFunc> does not reliably expose any information about "the piece of middleware" that has been registered, severely hampering middleware chain diagnostics like what I've shown above.
Now, of course builder implementations don't have to do that. They could build the Func<AppFunc, AppFunc> themselves, along with allowing for .WithX() style builder decorators, like Glimpse, and the problem would be solved. But if this signature is standardized, they have no real motivation to make that separation - sans diagnostics "vendors" chasing them down.
Here's my proposal:Let's not add this to the standard until we can also standardize, or at least make strong recommendations/define conventions, with regards to builder implementations. I don't want us to get painted into a corner and lose valuable run time tooling, Glimpse or otherwise.
--
You received this message because you are subscribed to the Google Groups ".NET HTTP Abstractions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-http-abstrac...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ryan, you’re correct that Katana’s IAppBuilder.Use supports a variety of signatures, including Func<AppFunc, AppFunc>, though Katana middleware primarily use the Type constructor pattern.
There’s minimal information to be had from just examining the types name, but I guess it’s better than nothing. We’ve avoided lambdas for a similar reason in that concrete types provide more legible stack traces.
If you really want detailed information from a middleware, the middleware author is going to need to volunteer that information. You’d want that info to be human readable. You also don’t want providing that information to be a burden to the middleware developer. The highest quality information the dev can provide will be in their published docs (readme.txt), and then their doc comments. I think there’s only a very limited amount of information that would be useful for them to provide at runtime.
~Chris