2.0 program creates instance of programs of different dotnet version

  • Thread starter Thread starter cherry
  • Start date Start date
C

cherry

Dear All,

I think it is a common problem in upgrading program from one DotNet
framework to another.
You may not have sufficient time to upgrade all the programs at one
time and thus will upgrade and deploy them phase by phase, right?

In my case, we have developed a program (2.0) which acts a common
access point of all these programs.
It uses CreateInstance method to initalize program as follow:


Dim asm As System.Reflection.Assembly
asm = System.Reflection.Assembly.LoadFrom(<Full
path of DLL>)

Dim ty As Type = asm.GetType(<Full Name of Class>)
obj = Activator.CreateInstance(ty)

However, I encountered the following error at CreateInstance() for 1.1
programs:
System.Reflection.TargetInvocationException {"Exception has been
thrown by the target of an invocation."}
Data {System.Collections.ListDictionaryInternal}
HelpLink Nothing
InnerException {System.IO.FileNotFoundException}
Message Exception has been thrown by the target of an invocation.
Source mscorlib
StackTrace at System.RuntimeTypeHandle.CreateInstance(RuntimeType
type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached,
RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)

at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly,
Boolean fillCache)

at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly,
Boolean skipVisibilityChecks, Boolean fillCache)

at System.Activator.CreateInstance(Type type, Boolean nonPublic)

at System.Activator.CreateInstance(Type type)

at Menu.frm_MainMenu.label_Click(Object sender, Int32 menuID) in C:
\ProgramSource\Program\2.0\CR11\Menu\frmMainMenu.vb:line 1066
TargetSite {System.Reflection.RuntimeMethodInfo}


It seems that instance created is not able to load referenced v1.1
assembly in path of .dll.

Does anyone have similar experience on such issue and have any
suggestion to me?

Please kindly advise.


Thanks!

Cherry
 
Hi All,

Here i need to clarify the error I've encountered:
System.Reflection.TargetInvocationException ----------{"Exception has
been thrown by the target of an invocation."}
Data----------{System.Collections.ListDictionaryInternal}
HelpLink----------Nothing
InnerException----------{"Method not found:
'Infragistics.Win.UltraWinToolbars.UltraToolbarsManager
VBbaseform.frmFilter.get_UToolbars()'."}
Message Exception has been thrown by the target of an invocation.
Source----------mscorlib
StackTrace----------" at
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached,
RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly,
Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly,
Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Menu.frm_MainMenu.label_Click(Object sender, Int32 menuID) in C:
\ProgramSource\Program\2.0\CR11\Menu\frmMainMenu.vb:line 1066"
TargetSite----------System.Reflection.RuntimeMethodInfo}

It seems that instance created is not able to load referenced v1.1
assembly in path of .dll. (Please note that The create instance
program is at different location with the dll to be created)


Any idea?
 
Back
Top