I've added Microsoft.Owin.Host.SystemWeb to an existing Asp.Net Web Forms project(to use Azure Active Directory Authentication) and get
[FileNotFoundException: Could not load file or assembly 'PostSharp.Sdk, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7' or one of its dependencies. The system cannot find the file specified.]
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +191
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +162
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +148
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +604 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +144
Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList1 errors, Boolean& conflict) +189
1 errors) +68
Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList
Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList1 errorDetails) +89 Owin.Loader.DefaultLoader.Load(String startupName, IList
1 errorDetails) +30
Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +165
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +37 System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +137
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +172
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +618
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343
As I understand Owin.Loader.DefaultLoader.SearchForStartupAttribute uses reflection and couldn't loaded some attribute, but it doesn't report which attribute it scans and where it's located.
Our project uses PostSharp for caching and logging, but (as far as I know) we are using version="4.3.21" and one attribute refers to "3.0.26.9", but anyway should redirect to 4.3.21 due to
<bindingRedirect oldVersion="0.0.0.0-4.3.21.0" newVersion="4.3.21.0" />
I've searched source code for "PostSharp.Sdk" , but didn't find any references.
Quick look in disassembles using JetBrain DotPeek also didn't show any references to PostSharp.Sdk. Note that Version=2.1 is very old.
There are links http://support.sharpcrafters.com/discussions/problems/2275-postsharp-is-not-compatible-with-microsoftowinsecurity-latest-version and issue with PostSharp cannot find assembly for system.web.mvc, version=3.0.0.0 when no projects reference it, that look similar, but they have opposite problem: PostSharp couldn't resolve MVC or Owin dlls.
Could anyone suggest how to identify which attribute (and on which class) refer to PostSharp.Sdk?
I consider to do myself what SearchForStartupAttribute does -scan the assembly(ies) for custom attributes and log all that found. Any better/more simple ideas?