简体   繁体   English

Activator.CreateInstance(Type type, params object[] args) 抛出错误“Unvalid URI: The URI is Empty”

[英]Activator.CreateInstance(Type type, params object[] args) throws error "Unvalid URI: The URI is Empty"

The program loads dll files from a subfolder.该程序从子文件夹加载 dll 个文件。 In debug in Visual Studio Professional 2022 it runs, as it should, but in release mode the following line throws the inner exception "Invalid URI: The URI is Empty"在 Visual Studio Professional 2022 中的调试中,它正常运行,但在发布模式下,以下行抛出内部异常“Invalid URI: The URI is Empty”

OB = Activator.CreateInstance(t, con.getConnection());

OB is an Object variable OB是一个Object变量
t is a type variable, which is "service", a class I wrote and is defined in the dlls t是一个类型变量,也就是“service”,我写的一个class,定义在dlls中
con.getConnection() is a Databaseconnection con.getConnection()是一个Databaseconnection连接

It also works for prior dlls but for new ones it throws the error.它也适用于以前的 dll,但对于新的 dll 会引发错误。

I compared the working dlls with the broken ones.我将工作的 dll 与损坏的 dll 进行了比较。

I found the problem on my own.我自己发现了问题。 My program pointed on the wrong Database in Release Mode, where the URI is saved, which occure the error我的程序在发布模式下指向了错误的数据库,其中保存了 URI,从而发生了错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM