Hi everybody,
I must admit, that is really driving me insane. I implemented
licensing in c# and everything works as expected. But when I do
_exactly_ the same in vb.net, it doesn't work.
What I try to do is implement a design-time license, so that the
developer, who uses my component, must have a valid license to compile
his solution. For that I implemented this license provider:
Public Class LicProvider
Inherits LicenseProvider
Protected Overridable Function IsKeyValid(ByVal key As String,
ByVal type As Type) As Boolean
Return False
End Function
Public Overloads Overrides Function GetLicense(ByVal context As
LicenseContext, ByVal type As Type, ByVal instance As Object, ByVal
allowExceptions As Boolean) As System.ComponentModel.License
If context.UsageMode = LicenseUsageMode.Runtime Then
MsgBox("RunTime")
Else
MsgBox("DesignTime")
End If
Return Nothing
End Function
End Class
My component uses the LicProvider as follows:
<LicenseProvider(GetType(LicProvider))> _
Public Class UserControl1
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
LicenseManager.Validate(GetType(UserControl1), Me)
End Sub
End Class
If I do the above in c# I can set a breakpoint on the line, which
checks the context.UsageMode, and it would break while compiling the
testapplication, which uses my licensed component. In vb.net it
doesn't.
What am I doing wrong? I searched for a solution for days and can't
find an answer. Most people seem to use the above for run-time
licensing, but that works as expected in both languages...
Desperatly yours,
Sascha