Licencing problem via Windows Service

Posted by: sklinck on 6 December 2023, 6:04 am EST

    • Post Options:
    • Link

    Posted 6 December 2023, 6:04 am EST

    Hi,

    The case has been already encoded (CAS-41946-G3Q7C9) in the support but maybe help can be foud here …

    We have a windows service in our solution and in this service, we use some graphical components to achieve some tasks

    For example, we use a C1FlexGrid to load dataset and then export the results in Excel.

    It works very well in release 4.5.2 v438 but not anymore in 4.8 (611).

    We have this error message :

    “2023/12/05 15:59:47”;3;;“Err : System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

    at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)

    at et.a(a A_0, ez A_1, ev A_2, Object A_3)

    at et.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)

    at C1.Util.Licensing.ProviderInfo.Validate(Type type, Object instance, Boolean showNagDialog, Boolean useAppDomainTest)

    at C1.Win.C1FlexGrid.C1FlexGrid…ctor()

    at OrfComponent.UIGrdMainClassToHerit…ctor() in C:\Orfival\Patch Gpms V212\Sources\Gpms .NET\OrfInterface\OrfComponent\UIGrdMainClassToHerit.vb:line 29

    at OrfComponent.UIGrdEnhanced…ctor() in C:\Orfival\Patch Gpms V212\Sources\Gpms .NET\OrfInterface\OrfComponent\UIGrdEnhanced.vb:line 62

    at OrfTask.UITaskResult.InitializeComponent() in C:\Orfival\Patch Gpms V212\Sources\Gpms .NET\OrfTask\UITaskResult.Designer.vb:line 36

    at OrfTask.UITaskResult…ctor() in C:\Orfival\Patch Gpms V212\Sources\Gpms .NET\OrfTask\UITaskResult.vb:line 50”

    Help is required ASAP :slight_smile:

    Thanks

  • Posted 6 December 2023, 6:47 am EST

    Hi,

    do you have a “license.licx” file in your service project? If yes: did you update the entries to match the new dll names and version? E.g. for C1FlexGrid:

    C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.4.8, Version=4.8.20....

    Hope this helps

    Wolfgang

  • Posted 6 December 2023, 6:49 am EST

    Hi,

    Yes and everything is working well in interactive mode (as we also use this code in interactive …)

    Thanks

  • Posted 6 December 2023, 6:55 am EST

    Is the license.licx file part of the starter project of the service, or is it included in some utility dll?

    I have to admit: we moved from C1 4.5.2 to .NET6 some time ago and ignored C1 4.8, so I cannot confirm whether .NET 4.8 services with current C1 versions could cause trouble. If my guesses don’t help further, it would be up to the C1 support guys…

    Best regards

    Wolfgang

  • Posted 6 December 2023, 7:06 am EST - Updated 6 December 2023, 7:07 am EST

    Hi,

    We have the service (Scheduler.exe) referencing a dll (SchedulerWork.dll) referencing a dll (SchedulerUtility.dll) → to make it simple

    And in the Utility.dll we have these method :

    Public Sub DatasetToText(ByVal oDataSet As DataSet,
                             ByVal TextFullFileName As String,
                             ByVal Delimiter As String,
                             Optional ByVal RemoveHeader As Boolean = False,
                             Optional ByVal RemoveQuote As Boolean = False,
                             Optional ByVal RemoveSpaceInHeader As Boolean = False)
        
        Dim oGrd As C1FlexGrid = New C1FlexGrid
       ....
    

    End Sub

    And we have the issue on the line “Dim oGrd As C1FlexGrid = New C1FlexGrid”

    licences.licx file is present with this reference : C1.Win.C1FlexGrid.C1FlexGrid, C1.Win.C1FlexGrid.4.8

    and the file is well linked in the proj file.

    Also, I removed all the gclicx files to keep only the old “licx” files but it’s the same.

    Thanks

  • Posted 6 December 2023, 7:12 am EST

    The license file is placed in the project file of “Scheduler.exe”?

    I actually don’t know whether .NET 4.8 projects require “gclicx” files or “license.licx”. For .NET6, only “gclicx” is supported, and they are auto generated on build.

    But I tested with an small project that is still .NET 4.8, and here I see this output on build:

    GrapeCity License Manager, 2.0
    License for ComponentOne WinForms Edition is successfully generated.

    So, a runtime license is generated, and also embedded in the exe file. Do you have similar output when compiling your project?

  • Posted 6 December 2023, 7:16 am EST

    I think that for 4.8, licx files are always supported (as everything seems to work fine interactively without glicx files)

  • Posted 6 December 2023, 7:21 am EST

    And there is no way to export dataset to excel files with C1 Winforms edition ?

    So without using a flexgrid to do this …

  • Posted 7 December 2023, 3:25 am EST

    Hi,

    Apologize for any inconvenience caused.

    We have responded to your generated Support Ticket: CAS-41946-G3Q7C9

    You can continue on the support ticket.

    And thanks Wolfgang, for looking out this issue.

    You are correct, that the .Net Core(5/6/7/8) requires a Gclicx(Runtime license) file only. No need for Licenses.licx file.

    For framework versions(4.5.2/4.8), After 2020v2 version i.e., 2020v3+, The licensing model is changed to Runtime license. So, Before or on 2020v2 We need to provide Licenses.licx. But after 2020v2, We need to license the Project by generating a runtime license(GCLICX).

    Note:- Licenses.Licx can work in 2020v2 and above version(Framework) but we did not recommend this for the latest versions(2020v3+). In some cases, we strongly needed Gclicx file.

    Like in this Windows Service scenario, We need a Gclicx file. Because a project having C1 dlls are consuming into the Main project. It’s somehow a UserControl Scenario. So, Licenses.licx will not work in this case.

    Regards,

    Nitin

  • Posted 7 December 2023, 6:04 am EST

    And the “gclicx” file should be automatically created on project build, shouldn’t it?

    @sklinck: do you see those two lines in build output for your service project?

    GrapeCity License Manager, 2.0
    License for ComponentOne WinForms Edition is successfully generated.

    You could also look at your exe file with “ILSpy” to check whether gclicx file is contained in the embedded resources.

    If this does not happen, you might have to create a runtime license yourself. See here: https://developer.mescius.com/componentone/docs/license/online-license/license-user-controls.html#i-heading-generate-a-run-time-license-through-visual-studio - the link goes directly to the section which describes how you could generate a license in the utility dll that allows usage in the service executable. But this might not be necessary, if both projects are under your own control.

    Best regards

    Wolfgang

  • Posted 7 December 2023, 6:13 am EST

    Hi Wolfgang,

    Yes, it creates automatically. If it is not created by itself, then we need to generate it manually by following the article you provided.

    In the case of WindowsService, there will be a UserControl Scenario. So, we must generate a UserControl Gclicx manually for the project which will be consumed in the Main project. It does not create itself. You need to follow this article to generate a runtime license : https://developer.mescius.com/componentone/docs/license/online-license/license-user-controls.html

    Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels