跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] C# .NET framework 4 程序集加载调试 bug

发表于
static class Program
{
[STAThread]
static void Main(){
try{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(AssembliesHandler);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm())
}catch(Exception ex){

}
}
static Assembly AssembliesHandler(object source,ResolveEventArgs e){
// 应用程序集会加载一些 resouce.dll ,例如
//Microsoft.ApplicationBlocks.ExceptionManagement.resource.dll,Employee.resource.dll
string assemblyName = new AssemblyName(e.Name).Name +".dll";
// 但是指定路径下的路径只有 不带 resources 的 dll
// Microsoft.ApplicationBlocks.ExceptionManagement.dll,Employee.dll
string librariesPath = @"C:\Users\ddl\"
return Assembly.LoadForm(assenblyName+librariesPath)
}
}
就感觉挺奇怪的这些 resource.dll 是哪里来的,问了 GPT 说是 和什么多语言文化有关系,在 main 方法里面 Thread.currentInfo(en-us) 也没什么用
后面在 AssembliesHandler 里面判断如果包含 resources 的话就 return null 跳过,
if(assemblyName.contains(resources.dll) return null;
但是这个会直接触发异常,导致程序一直在重试加载 Microsoft.ApplicationBlocks.ExceptionManagement.resource.dll,Employee.resource.dll 。就是 return null 会触发异常,应该换一个什么比较好?
麻烦大神们帮忙看一下
visual studio 2019 professional

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.