Infopath code error - InfoPath Dev
in

InfoPath Dev

Infopath code error

Last post 05-14-2011 08:59 AM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-11-2011 12:16 PM

    Infopath code error

    Hello, I'm trying to get my form to work with a topaz signature pad.  Anyway I'm getting an error when I debug my form when I add this line to my code:

     'internal Topaz.SigPlusNET sigPlus = new Topaz.SigPlusNET();'

     I'm not sure if anyone will have any experience with this, but I've looked around and seen this error pop up for other issues so I'm hoping someone will have seen this at some point or might have some insight.  Anyway the error I get on startup is this:

     

    InfoPath cannot open the selected form because of an error in the form's code.
    System.Reflection.TargetInvocationException, mscorlib

    System.Reflection.TargetInvocationException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'SigPlusNET, Version=1.1.3358.14336, Culture=neutral, PublicKeyToken=6aef07010bb0624f' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)
    File name: 'SigPlusNET, Version=1.1.3358.14336, Culture=neutral, PublicKeyToken=6aef07010bb0624f' ---> System.Security.Policy.PolicyException: Required permissions cannot be acquired.
       at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
       at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)
       at EDCR_After_Customization_.FormCode..ctor(IRemoteArgumentArrayContract initArgs)


       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
       at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
       at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
       at System.AddIn.AddInExecutorInternal.System.AddIn.IAddInExecutorInternal.Execute(String assemblyName, String className, IRemoteArgumentArrayContract initArgs)
       at System.AddIn.AddInExecutorInternal.System.AddIn.IAddInExecutorInternal.Execute(String assemblyName, String className, IRemoteArgumentArrayContract initArgs)
       at System.AddIn.AddInExecutor`1.Execute(String assemblyName, String className, IRemoteArgumentArrayContract args)
       at Microsoft.VisualStudio.Tools.Applications.EntryPointAdapter..ctor(IRemoteArgumentArrayContract initArgs)
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
       at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
       at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
       at System.AddIn.AddInExecutorInternal.System.AddIn.IAddInExecutorInternal.Execute(String assemblyName, String className, IRemoteArgumentArrayContract initArgs)
       at System.AddIn.AddInExecutorInternal.System.AddIn.IAddInExecutorInternal.Execute(String assemblyName, String className, IRemoteArgumentArrayContract initArgs)
       at System.AddIn.IAddInExecutorInternal.Execute(String assemblyString, String className, IRemoteArgumentArrayContract args)
       at System.AddIn.AddInExecutor`1.Execute(String assemblyName, String className, IRemoteArgumentArrayContract args)
       at Microsoft.VisualStudio.Tools.Applications.Internal.ExceptionFilter.ExceptionFilterHelper.ExecuteCustomization(AddInExecutor`1 executor, String assemblyName, String className, IRemoteArgumentArrayListContract args, IExceptionFilterCallback callback)
       at Microsoft.VisualStudio.Tools.Applications.AddInImpl.AttemptInternalLoad(IAppDomainBindingContract appDomainBinding, String appBase, String configFile, PermissionSet topOfStackPermission, StrongName[] strongNameAssemblies)

     

    I notice it mentions something about permissions in there, but I really don't know what to make of this.  The reference is signed according to the properties...

     

    Thanks in advance for your help!

    Seb

  • 05-12-2011 02:13 PM In reply to

    Kind of a longshot, but have you tried modifying the form's security settings, so the template is full trust?

    Hilary Stoupa

  • 05-13-2011 12:43 PM In reply to

    Hi Hilary, thank you for the reply.  I haven't been able to get it to full trust yet, I'm trying to get a trusted root certificate, but I know I've tried putting things in the code before that required full trust and it threw an error about needing full trust before I could even run it.  This one seems to be some kind of run time error...  I'm thinking it probably has something to do with the .dll I'm referencing because I just pulled it out of their example and imported it into my code; I don't really know anything about assemblies or if I did it properly...  It recognizes the reference in the code but I don't know if I needed to do something else to make it work as well.

     

    Thanks!

  • 05-14-2011 08:59 AM In reply to

    I'm pretty sure Full Trust is the only way to solve this.  InfoPath isn't allowed to access the local hardware, peripherals, or filesystem without running in full trust.  It doesn't have any way of knowing at compile time that you are going to try to access a peripheral, and that's why it gets upset when the code is running.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.