SLPS Developer Discussion Developer level questions on Code Protection, Licensing, customisation APIs etc
InishTech Support Forums > SLPS Developer Discussion > Pressing Cancel During License Entry Displays Exception Dialog Login to add this as a favourite.
User avatar
Member
Member
molenator - 7/25/2010 6:03:18 AM
   
Pressing Cancel During License Entry Displays Exception Dialog

Pressing Cancel During License Entry Displays Exception Dialog

Is there a place to catch exceptions so this won't happen?

Thanks!

Karl

See the end of this message for details on invoking 

just-in-time (JIT) debugging instead of this dialog box.

 

************** Exception Text **************

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Licensing.NotLicensedException: Canceled

   at dK.A(Assembly A_0, Byte[] A_1, ISLMVirtualMachineParams A_2)

   at dK.A(Assembly A_0, String A_1, ISLMVirtualMachineParams A_2)

   at Microsoft.Licensing.SLMRuntime.InternalSVMExecMethod(Assembly declaringAssembly, String SVMMethodId, ISLMVirtualMachineParams paramsReader)

   at Microsoft.Licensing.SLMRuntime.SVMExecMethod(Object obj, String SVMMethodId, Object[] args)

   at Mole.EntryPoint..ctor()

   --- End of inner exception stack trace ---

   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)

   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)

   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)

   at System.Activator.CreateInstance(Type type, Boolean nonPublic)

   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

   at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

   at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ClassAndAssemblySpec.CreateInstanceOrType(Dictionary`2 dictionary, AbstractAssemblyResolver resolver, InstanceOrType instOrType)

   at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ClassAndAssemblySpec.CreateInstance(AssemblyResolver resolver)

   at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.CreateViewer(IntPtr hwnd, HostServicesHelper hsh, SafeProxyWrapper proxy)

 

 

************** Loaded Assemblies **************

mscorlib

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

----------------------------------------

Microsoft.VisualStudio.Platform.AppDomainManager

    Assembly Version: 10.0.0.0

    Win32 Version: 10.0.30319.1

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Platform.AppDomainManager/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Platform.AppDomainManager.dll

----------------------------------------

System

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 built by: RTMRel

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

System.Configuration

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

----------------------------------------

System.Xml

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 built by: RTMRel

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

----------------------------------------

System.Windows.Forms

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 built by: RTMRel

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

----------------------------------------

System.Drawing

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 built by: RTMRel

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

----------------------------------------

Microsoft.VisualStudio.DebuggerVisualizers

    Assembly Version: 10.0.0.0

    Win32 Version: 10.0.30319.1

    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.DebuggerVisualizers/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.DebuggerVisualizers.dll

----------------------------------------

Mole.Visualizer.VS2010

    Assembly Version: 5.0.0.0

    Win32 Version: 5.0.0.0

    CodeBase: file:///C:/Users/mole/Documents/Visual%20Studio%202010/Visualizers/Mole.Visualizer.VS2010.dll

----------------------------------------

Microsoft.Licensing.Runtime2.0

    Assembly Version: 1.0.0.1

    Win32 Version: 3.0.1908.866

    CodeBase: file:///C:/Users/mole/Documents/Visual%20Studio%202010/Visualizers/Microsoft.Licensing.Runtime2.0.DLL

----------------------------------------

Microsoft.Licensing.Utils2.0

    Assembly Version: 1.0.0.1

    Win32 Version: 3.0.1908.866

    CodeBase: file:///C:/Users/mole/Documents/Visual%20Studio%202010/Visualizers/Microsoft.Licensing.Utils2.0.DLL

----------------------------------------

Microsoft.Licensing.Permutation_41754_2.0

    Assembly Version: 1.0.0.1

    Win32 Version: 3.0.1908.866

    CodeBase: file:///C:/Users/mole/Documents/Visual%20Studio%202010/Visualizers/Microsoft.Licensing.Permutation_41754_2.0.DLL

----------------------------------------

System.Core

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 built by: RTMRel

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

----------------------------------------

PresentationFramework

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll

----------------------------------------

WindowsBase

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 built by: RTMRel

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll

----------------------------------------

PresentationCore

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 built by: RTMRel

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll

----------------------------------------

System.DirectoryServices

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.DirectoryServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.DirectoryServices.dll

----------------------------------------

System.Web

    Assembly Version: 4.0.0.0

    Win32 Version: 4.0.30319.1 built by: RTMRel

    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Web/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Web.dll

----------------------------------------

 

************** JIT Debugging **************

To enable just-in-time (JIT) debugging, the .config file for this

application or computer (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

enabled.

 

For example:

 

<configuration>

    <system.windows.forms jitDebugging="true" />

</configuration>

 

When JIT debugging is enabled, any unhandled exception

will be sent to the JIT debugger registered on the computer

rather than be handled by this dialog box.

 

 


User avatar
InishTech Dev
InishTech Dev
RBartelink - 7/26/2010 1:45:37 PM
   
RE:Pressing Cancel During License Entry Displays Exception Dialog

 Hi Molenator,

The exception that's being thrown is just a standard .NET exception, so you can just handle it like you would any other. Depending on the type of app you have, different approaches will make sense. Some approaches are outlined in http://www.inishtech.com/Support/FAQs/FAQs/Developer/Handling-License-Exceptions-.aspx

Some approaches that may make sense might be to wrap the code that's calling your protected code in try/catches which divert to a "sign up now", screen etc.

Or you could have a single general wrapper method such as:

 

class MyWrappers
{
    static void ExplainLicensingIssues(Action action)
    {
        try 
        {
            action();
        }
        catch(NotLicensedException)
        {
            // ... Global handling
        }
    }
}

Which one could then use e.g., like this:


void OnSpecialFeatureTriggering(object source, EventArgs args)

{

 MyWrappers.ExplainLicensingIssues( () => System.LicensedAction());

}

--Ruben


1

There are currently no users on-line.

  • Sticky
  • Locked sticky
  • Hot sticky
  • Hot locked sticky
  • Thread
  • Hot thread
  • Locked thread