Behavior change: new BaseDirectory and separate AppDomains per Endpoint Instance

Each Service Instance runs within its own AppDomain. This is to allow for replacing assemblies without having to reboot the HostServer.

In K2 blackpearl 4.6.7, the AppDomain BaseDirectory has changed from:

C:\Program Files (x86)\K2 blackpearl\Host Server\Bin\

To: C:\Program Files (x86)\K2 blackpearl

Code referencing the BaseDirectory in SmartObjects built on K2 blackpearl 4.6.6 will return an error after upgrading to K2 blackpearl 4.6.7. References to assemblies using the AppDomain.CurrentDomain.BaseDirectory value should rather be using the Assembly.Location property (see http://msdn.microsoft.com/en-us/library/system.reflection.assembly.location(v=vs.110).aspx)

Background

An Endpoint’s ServiceInstance’s assembly used to be loaded into the K2HostServer’s AppDomain which is located in the C:\Program Files (x86)\K2 blackpearl\Host Server\Bin\ directory and was then able to reference dependent assemblies in the C:\Program Files (x86)\K2 blackpearl\ServiceBroker directory as the assembly physically resided in that directory. And it could reference assemblies in C:\Program Files (x86)\K2 blackpearl\Host Server\Bin\ due to the AppDomain being in that directory. Since the behavioral change making it run in its own AppDomain, the only way to reference dependent assemblies in both those locations was to make the BaseDirectory C:\Program Files (x86)\K2 blackpearl and change the PrivateBinPath to the C:\Program Files (x86)\K2 blackpearl\ServiceBroker and C:\Program Files (x86)\K2 blackpearl\Host Server\Bin\ directories as these paths are relative to the BaseDirectory.