What are the exact reasons that the creation of an appdomain is so expensive. They share the same heap, the same assemblies etc. What exactly needs to be done by the CLR that comsumes so much resources?
We have seen scenarios where accessing a type/instance from the other appdomain takes up 10 seconds (update: all required assemblies that will be used by both appdomains have already been loaded into the current appdmomain that spawns the new appdomain, except one). Interestingly enough this happens only upon the first access. All subsecent access is very fast.
Update2:
We have attached the VS 2010 sampling profiler and here is the result:
Functions Doing Most Individual Work: System.AddIn.Pipeline.FrameworkElementAdapters.ViewToContractAdapter(class System.Windows.FrameworkElement) Exclusive Samples %43,02
(yes we are using the WPF addin APIs here)