L
localhost
Help!
I have a WinForm that at startup creates a custom principal (inherits
from GenericPrincipal) and assign it and its roles to the current
thread.
The WinForm then loads a class library via Reflection. The class
library works fine until I assign a security attribute to the class
like this:
[System.Security.Permissions.PrincipalPermission(System.Security.Permissions.SecurityAction.Demand
,
Role="FormUser")]
public class TestForm : BaseForm
{
This "class library" is actually a WinForm that I compiled as a class
library in the VS.NET 2003 Project settings.
Anyway, when the main form loads the class library form, I get this
error:
An unhandled exception of type
'System.Reflection.ReflectionTypeLoadException' occurred in
mscorlib.dll
Additional Information: One or more fo the types in the assembly
unable to load.
The loader code looks like this:
Assembly childAssembly = Assembly.LoadFrom( loadInfo );
foreach ( System.Reflection.Module childModule in
childAssembly.GetModules() )
{
try
{
foreach( Type childType in childModule.GetTypes() )
{
if ( childType.Name.ToLower().StartsWith("subsystem") == true
)
{
if ( TestChildForm(childType) == true )
{
Form testForm =
(Form)Activator.CreateInstance(childType) ;
}
}
}
}
catch( Exception xxx )
{
string fjjf = xxx.ToString();
int ghjg=4;
}
}
I have a WinForm that at startup creates a custom principal (inherits
from GenericPrincipal) and assign it and its roles to the current
thread.
The WinForm then loads a class library via Reflection. The class
library works fine until I assign a security attribute to the class
like this:
[System.Security.Permissions.PrincipalPermission(System.Security.Permissions.SecurityAction.Demand
,
Role="FormUser")]
public class TestForm : BaseForm
{
This "class library" is actually a WinForm that I compiled as a class
library in the VS.NET 2003 Project settings.
Anyway, when the main form loads the class library form, I get this
error:
An unhandled exception of type
'System.Reflection.ReflectionTypeLoadException' occurred in
mscorlib.dll
Additional Information: One or more fo the types in the assembly
unable to load.
The loader code looks like this:
Assembly childAssembly = Assembly.LoadFrom( loadInfo );
foreach ( System.Reflection.Module childModule in
childAssembly.GetModules() )
{
try
{
foreach( Type childType in childModule.GetTypes() )
{
if ( childType.Name.ToLower().StartsWith("subsystem") == true
)
{
if ( TestChildForm(childType) == true )
{
Form testForm =
(Form)Activator.CreateInstance(childType) ;
}
}
}
}
catch( Exception xxx )
{
string fjjf = xxx.ToString();
int ghjg=4;
}
}