06-23-2009 05:12 AM - last edited on 06-24-2009 02:12 PM by Laura F.
Hello, i'm having the following problem: I have an application (bin) in a server and i'm trying run it from my computer. When the application tries to create an WaveformGraph object, I get the below error. When I run the application in local, it works fine.
Thank you.
System.MethodAccessException
Message="NationalInstruments.UI.WindowsForms.Internal.WindowsFormsLicenseProvider..ctor()"
Source="mscorlib"
StackTrace:
en System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
en System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
en System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
en System.Activator.CreateInstance(Type type, Boolean nonPublic)
en System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
en System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
en System.Activator.CreateInstance(Type type, Object[] args)
en System.SecurityUtils.SecureCreateInstance(Type type, Object[] args)
en System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
en System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
en System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
en NationalInstruments.UI.WindowsForms.WaveformGraph..ctor()
...
06-23-2009 05:36 AM
Sorry, I forgot saying that the object is created in the following way:
Assembly assembly = Assembly.LoadFrom("xxxxx");
Type type = assembly.GetType("yyyyy");
Object = Activator.CreateInstance(type);
If it is created in a "normal" way, there isn't problem.
Thank you!
06-24-2009 07:00 AM
It looks to me like the problem is that you are creating the control using reflection and you are running the program from a location with security permissions configured not to allow reflection. Have you tried creating a core Framework data type (as opposed to an MStudio data type) through reflection and running it in this scenario to see if it works? If this doesn't work, then I'm pretty confident that you'll need to fix this problem by granting refelection permission to your application, using the .NET Framework Configuration Tool.
David Rohacek
National Instruments
06-24-2009 11:37 AM
That's right. I've set Full Trust for Intranet using caspol.exe in the 2.0 Framework directory: capol.exe -q -m -ag All_code -zone Intranet FullTrust.
Important: You can use "Microsoft .NET Framework 1.1 Wizards" only if you work with Framework 1.1.
Thank you.
06-26-2009 11:54 AM
You're welcome.
I appreciate you posting the details.
David Rohacek
National Instruments