当我将程序集(xxx.dll)加载到新的 AppDomain 并尝试在那里创建 UserControl 时,出现异常:
Could not load file or assembly 'xxx.resources' or one of its dependencies.
当我将程序集加载到 Main AppDomain 时,它工作正常。
为什么会出现异常?
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
//这里出现异常
System.Uri resourceLocater = new System.Uri("/Company.AddInApp;component/controls/usercontrol.xaml", System.UriKind.Relative);
#line 1 "..\..\..\Controls\UserControl1.xaml" stem.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}