Search code examples
c#activator

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


The program loads dll files from a subfolder. 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"

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

OB is an Object variable
t is a type variable, which is "service", a class I wrote and is defined in the dlls
con.getConnection() is a Databaseconnection

It also works for prior dlls but for new ones it throws the error.

I compared the working dlls with the broken ones.


Solution

  • 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