Skip to content

Commit 4fc858c

Browse files
committed
added more DirectoryCatalog when load composition container if have isolation setup
1 parent 0988f28 commit 4fc858c

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

SocketBase/Extensions.cs

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel.Composition.Hosting;
4+
using System.IO;
35
using System.Linq;
46
using System.Text;
7+
using SuperSocket.SocketBase.Command;
58
using SuperSocket.SocketBase.Metadata;
69
using SuperSocket.SocketBase.Pool;
7-
using SuperSocket.SocketBase.Command;
8-
using System.ComponentModel.Composition.Hosting;
910

1011
namespace SuperSocket.SocketBase
1112
{
@@ -75,12 +76,26 @@ public static ExportProvider GetCurrentAppDomainExportProvider(this AppDomain ap
7576
if (exportProvider != null)
7677
return exportProvider;
7778

79+
var isolation = IsolationMode.None;
80+
var isolationValue = appDomain.GetData(typeof(IsolationMode).Name);
81+
82+
if (isolationValue != null)
83+
isolation = (IsolationMode)isolationValue;
84+
7885
var catalog = new AggregateCatalog();
7986
catalog.Catalogs.Add(new AssemblyCatalog(typeof(IAppServer).Assembly));
80-
catalog.Catalogs.Add(new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory, "*.dll"));
87+
88+
catalog.Catalogs.Add(new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory, "*.*"));
89+
90+
if (isolation != IsolationMode.None)
91+
{
92+
catalog.Catalogs.Add(new DirectoryCatalog(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.FullName, "*.*"));
93+
}
94+
8195
exportProvider = new CompositionContainer(catalog);
8296

8397
appDomain.SetData(CurrentAppDomainExportProviderKey, exportProvider);
98+
8499
return exportProvider;
85100
}
86101
}

0 commit comments

Comments
 (0)