System::Activator::CreateInstance? 
Author Message
 System::Activator::CreateInstance?

Microsoft::Win32::RegistryKey* key =
Microsoft::Win32::Registry::LocalMachine->OpenSubKey
("Software\\MyCompany\\MyApp\\Provider");

System::String* assembly = key->GetValue
(S"ProviderAssembly")->ToString();
System::String* typeName = key->GetValue
(S"ProviderTypeName")->ToString();

IProvider* mProvider = dynamic_cast<IProvider*>
(System::Activator::CreateInstance(assembly, typeName)-

Quote:
>Unwrap());

now I have verified that both the assembly path and type
name are valid... well i know the assembly path is valid
since if i try to open the entire path it gives me the
open will for the .dll ... the assembly is a C# .NET
assembly ... it implements that interface but the managed
c++ assembly cannot load it ... it says it or one of its
dependencies cannot be found ... i have also tried

System::Reflection::Assembly::Load(assembly);

but that does not work either ... any ideas or
suggestions?



Sat, 15 Oct 2005 02:43:41 GMT  
 System::Activator::CreateInstance?
Adam,

Quote:
>now I have verified that both the assembly path and type
>name are valid... well i know the assembly path is valid
>since if i try to open the entire path it gives me the
>open will for the .dll ...

If ProviderAssembly is a file path, you should use
Activator::CreateInstanceFrom / Assembly::LoadFrom instead.

If ProviderAssembly is the assembly name, you can use Fuslogvw to
diagnose binding errors.

Mattias

===

http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.



Sat, 15 Oct 2005 05:59:45 GMT  
 System::Activator::CreateInstance?
Sweet, thanks! I had been using assembly names rather
than paths but switched to paths so the assembly wouldn't
have to be registered with the GAC.


Sat, 15 Oct 2005 20:13:46 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. System.Activator.CreateInstance() - evidence?

2. Unhandled Exception: System.Configuration.ConfigurationException: Could not create System Configuration.NameValueSectionHandler, System

3. ? HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_

4. System.Runtime.InteropServices.VTableCallsNotSupportedException

5. bufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbufferoverrunbuf

6. System.Drawing.Bitmap.FromResource throwing System.ArgumentException

7. System.Activator.CreateInstance failed on internal class in the same assembly.

8. CABLE BOX DESCRAMBLER PLANS ((LEGAL)),.,.,,.,,,,,,,,,,,,,,,.,.,.,,,,,,,,,,,,,,,,,,,,,,,,.,,,,,,,,.,.,,,,,,,,,,,.,,,,,,, 8077

9. System.Security.Cryptography.CryptographicException: Bad Data.

10. C# System.UnauthorizedAccessException

11. System.ExecutionEngineException - framework bug?

12. System.Management.ManagementObject problem

 

 
Powered by phpBB® Forum Software