Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - 2.0 program creates instance of programs of different dotnet version

Reply
 
Old 09-09-2008   #1 (permalink)
cherry


 
 

2.0 program creates instance of programs of different dotnet version

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

My System SpecsSystem Spec
Old 09-09-2008   #2 (permalink)
cherry


 
 

Re: 2.0 program creates instance of programs of different dotnetversion

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?
On 9$B7n(B9$BF|(B, $B2<8a(B2$B;~(B53$BJ,(B, cherry <cherryparadise...@xxxxxx> wrote:
Quote:

> 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
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Which version of dotnet? .NET General
Beginner - which is best dotnet.VB or dotnet.VC? .NET General
Getting old version of program from shortcut Vista General
Startup Programs have more than one instance Vista General
DotNet program opens shadow datafile rather than the current one Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46