G
Guest
Hi,
I'm creating an AppDomain and creating an instance of a class. This works
fine unless I use caching, which I need to use.
The exception that I get is of type "System.IO.FileLoadException" which
message is:
{"The given assembly name or codebase, 'MyAssemblyDisplayName', was
invalid." }
The stack trace is:
"
Server stack trace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean
throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)\r
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)\r
at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark& stackMark)\r
at System.Activator.CreateInstance(String assemblyName, String typeName,
Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture, Object[] activationAttributes, Evidence securityInfo,
StackCrawlMark& stackMark)\r
at System.Activator.CreateInstance(String assemblyName, String typeName)\r
at System.AppDomain.CreateInstance(String assemblyName, String typeName)\r
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String
typeName)\r
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase
mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext,
Object[]& outArgs)\r
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
"
I have set permissions for the user everyone on the cache directory.
The source code I am using is:
appDomain.SetShadowCopyPath(appDomain.BaseDirectory);
appDomain.SetShadowCopyFiles(); //if i skip this, the following works well
MyClass myClass = (MyClass)
appDomain.CreateInstanceAndUnwrap(assemblyDisplayName,myClassDisplayName);
Thanks a lot.
Pablo.
I'm creating an AppDomain and creating an instance of a class. This works
fine unless I use caching, which I need to use.
The exception that I get is of type "System.IO.FileLoadException" which
message is:
{"The given assembly name or codebase, 'MyAssemblyDisplayName', was
invalid." }
The stack trace is:
"
Server stack trace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean
throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)\r
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)\r
at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark& stackMark)\r
at System.Activator.CreateInstance(String assemblyName, String typeName,
Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args,
CultureInfo culture, Object[] activationAttributes, Evidence securityInfo,
StackCrawlMark& stackMark)\r
at System.Activator.CreateInstance(String assemblyName, String typeName)\r
at System.AppDomain.CreateInstance(String assemblyName, String typeName)\r
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String
typeName)\r
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase
mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext,
Object[]& outArgs)\r
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
"
I have set permissions for the user everyone on the cache directory.
The source code I am using is:
appDomain.SetShadowCopyPath(appDomain.BaseDirectory);
appDomain.SetShadowCopyFiles(); //if i skip this, the following works well
MyClass myClass = (MyClass)
appDomain.CreateInstanceAndUnwrap(assemblyDisplayName,myClassDisplayName);
Thanks a lot.
Pablo.