C1.Win.C1Themes version 4.8.20241.657

Posted by: james on 13 June 2024, 1:48 am EST

  • Posted 13 June 2024, 1:48 am EST

    Hi

    I’ve noticed an issue with C1.Win.C1Themes version 4.8.20241.657

    It has a dependency of C1.Zip version 2.0.20233.4

    Updating C1.Zip causes an issue.

    To reproduce the issue,

    1. install C1.Win.C1Themes version 4.8.20241.657 with NuGet.
    2. Add a theme controller to a form.
    3. using NuGet update C1.Zip to the latest version, “8.0.20241.6”, which technically installs as version 2.0.20241.6, but within a folder named "8.0.20241.6.
    4. Building and Running the Application still work, because an assembly binding is added to App.config.
    5. Exit Visual Studio.
    6. Go back into Visual Studio, and open the project.
    7. Open the form, and you get error: "The type initializer for C1.Win.C1Themes.C1Theme threw an exception. Could not load file or assembly C1.Zip Version 2.0.20233.4

    In otherwords, it appears the binding redirect fixes runtime, but not design time.

    I’m not sure what the issue is:

    • maybe C1.Win.C1Themes didn’t get its references updated in the latest version? In other words, the 4.8.20241.657 version of C1Themes points to the 2.0.20233.4 version of C1.Zip.
    • or maybe the naming of C1.Zip with a different folder name to the actual version is causing an issue.

    If you can’t generate the issue from my steps, I can provide a sample.

    Hope that all makes sense - I spent several hours today going around in circles to try and put my finger on the issue.

  • Posted 13 June 2024, 5:00 am EST

    Hi James,

    I had a similar issue with C1.Win.FlexGrid.ImportExport and C1.Excel in .NET6, so I assume the same applies here.

    Your project probably does not require a Nuget package reference to “C1.Zip”, as this is a transitive dependency of “C1.Win.C1Themes”. So, it should be sufficient to remove the Nuget package reference to “C1.Zip” from your projects.

    Does your project still use the old nuget configuration (with a file “packages.config” in the project), or do you use the new style, where the package references are only declared in the csproj file?

    Best regards

    Wolfgang

  • Posted 13 June 2024, 8:14 pm EST

    Hi Wolfgang

    The feature you mention is only part of .NET 6+. (Core)

    We are using the latest .NET Framework, (4.8.1)

    Please run through my steps to reproduce the issue, and let me know.

    C1Themes appears to be the only package out of the 20 or so C1 packages we use with this issue.

    Thanks

    Kind Regards

    James

  • Posted 14 June 2024, 2:09 am EST

    Hello James,

    Thank you for providing such detailed steps to replicate the behavior. We were able to reproduce the behavior on our end.

    We have escalated it to the developers to get their insights on the behavior. Rest assured, we’ll update you once we get any necessary information.

    [Internal Tracking ID: C1WIN-32435]

    Regards,

    Uttkarsh.

  • Posted 14 June 2024, 2:50 am EST

    Hi Uttkarsh

    Thanks for your response.

    Kind Regards

    James

  • Posted 21 June 2024, 8:17 am EST

    Hello James,

    As per the developers, the behavior you’ve reported is a bug, and you are correct that the dependency was not updated. The ETA for the fix is 2024 v1 hotfix 2.

    [Internal Bug ID: C1WIN-32527]

    We will update you once the issue is fixed. Thank you for your patience and cooperation.

    Regards,

    Uttkarsh.

  • Posted 26 June 2024, 9:21 pm EST

    Hi Uttkarsh

    That’s great. Thanks for the information. - I should probably create another post for this, but do you know if there is a setting I can change so these sorts of errors throw an exception during runtime instead of a prompting a MessageBox? I ask because we have a few backend apps where the message pops up as a message box when that particular task is run which blocks execution, and a user has to press okay. If it was an exception our application would handle it by catching it, and moving on to its next task in its queue, instead of halting our batch processor.

    As mentioned, we are okay at the moment because we are using the older DLL, but if similar things ever happen it would be nice to have as an exception rather than a message box.

    Kind Regards

    James

  • Posted 27 June 2024, 3:04 am EST

    Hi James,

    hope that I give the answer that matches your question ;-):

    You can add application wide handlers for all uncatched exceptions: make this call at the beginning of your main method:

    Application.ThreadException += new ThreadExceptionEventHandler(AppBaseMain.OnThreadException);
    AppDomain currentDomain = AppDomain.CurrentDomain;
    currentDomain.UnhandledException += new UnhandledExceptionEventHandler(AppBaseMain.OnUnhandledException);

    The event handlers could e.g. log the error:

    
    public static void OnThreadException(object sender, ThreadExceptionEventArgs args)
    {
      //Do something with the exception...
    }
    public static void OnUnhandledException(object sender, UnhandledExceptionEventArgs args)
    {
      //Do something with the exception...
    }

    Best regards

    Wolfgang

  • Posted 27 June 2024, 3:44 am EST

    Hi Wolfgang

    I think you may have misread my question. The issue is that the error is displayed via a MessageBox by the C1 library, and not thrown as an exception. Hence there is nothing to catch. Hope that makes sense.

    Kind Regards

    James

  • Posted 27 June 2024, 3:45 am EST

    @James sorry for misunderstanding…

  • Posted 27 June 2024, 9:34 am EST

    Hello James,

    We apologize, but we are not sure what you mean by the MessageBox here. When we create an application using the latest C1Themes, we do not encounter any MessageBox popups. Please refer to the attached sample. (see WinFormsApp1.zip)

    Could you provide more details about the MessageBox you mentioned and the steps to reproduce it?

    While searching online, we found an MSDN article explaining how to change the severity levels of messages. This method will mark the violations as errors and cause builds to fail. Please see if it helps.

    Customize Roslyn analyzer rules: https://learn.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2022

    Regards,

    Uttkarsh.

  • Posted 15 July 2024, 2:11 am EST - Updated 15 July 2024, 2:18 am EST

    Hi Uttkarsh

    Sorry for the delayed reply.

    I have a built a sample to show you the behaviour.

    To get an acceptable file size, I had to remove the packages and build folder, so you will have to build the project.

    I have used a Chilkat library as an example to compare with the C1Themes/Zip

    1. If you build and launch you will notice everything is OK, no problem.

      2a) Close, and browse to the build folder, rename ChilkatDotNet48.dll to ChilkatDotNet48.dll.old

      2b) Launch exe from build folder and you will notice an “Exception”, because the Chilkat dll is missing.

      (screenshot attached)

      3a) Close, and rename ChilkatDotNet48.dll.old in the build folder to ChilkatDotNet48.dll, and also rename C1.Zip.dll to C1.Zip.dll.old

      3b) Launch exe from build folder and you will notice a “MessageBox” generated by the C1 library.

      (screenshot attached).

    My question: is it possible to get C1 to throw an exception instead of a MessageBox which blocks the flow, and makes it impossible for a system service to handle.

    I realise this is an edge case, but it did happen in the real world, when the dll version that the app was expecting was different than what was placed in the installation folder.

    If C1 could let the exception be thrown, the way that Chilkat, and others do so that would be great, and our backend app would not be stuck.

    Basically, our backend app uses a library we built for a certain task that takes advantage of C1, and when it got to that task it was waiting indefinitely, because of the message box, and could not move on to its next task.

    Hope that makes sense, and if there’s an easy way to do this - otherwise we are looking at building scheduling into the process, and could force a kill if a certain amount of time elapses without response from the library.

    ExceptionMessageBox.zip

  • Posted 15 July 2024, 7:30 am EST - Updated 15 July 2024, 7:36 am EST

    Hi James,

    you should migrate your project to the “Package reference” version instead of using “package.config”. After doing this, you can remove the reference to “C1.Zip” completely and rely on C1Themes providing the matching version. You cannot define a C1.Zip version different from the one used in C1Themes.

    After doing this, the error did not happen to me.

    I hope your rather old project supports “Package Reference”. On my machine, Visual Studio switched it automatically to .NET 4.8.

    Best regards

    Wolfgang

  • Posted 16 July 2024, 2:19 am EST

    Hello James,

    The exception occurs when C1ThemeController tries to load the inbuilt themes but fails to do so as C1.Zip DLL is not available. It seems the exception is handled internally when C1ThemeController fails to load C1Theme to prevent the application from crashing.

    We have escalated your concerns to the development team to get their insights. Rest assured, we’ll update you once we get any information.

    [Internal Tracking ID: C1WIN-32663]

    Also, you can use the PackageReference method as suggested by Wolfgang. This will ensure that the C1.Zip package is added as a dependency of C1Themes.

    PS: Thank you, Wolfgang, for your input.

    Regards,

    Uttkarsh.

  • Posted 17 July 2024, 12:47 am EST

    Hi Guys

    Thanks for the info. I’m guessing the use of something like “this.DesignMode” could be used to have the message only show whilst in the Visual Studio Designer to the user, so that it is handled nicely, which will allow the exception during runtime.

    Either way, thanks for your feedback - and we will be building Task Scheduling into our backend processor to catch for infinite waits - but this would be a nice to have.

    Cheers

    James

  • Posted 17 July 2024, 5:30 am EST

    Hi James,

    I somehow feel ignored ;-). Is there any reason why you define a custom C1Zip version, instead of relying on the version provided by C1Themes? If you use my approach (and switch to “Package Reference”), the error should not happen, and your workarounds should not be necessary.

    You are probably right - it would be nice if C1 did not show a message box in this situation in background processes. But as far as I understand it, it should be possible to resolve the problem for you without having to wait for a C1 fix.

    Best regards

    Wolfgang

  • Posted 17 July 2024, 10:38 pm EST

    Hi Wolfgang

    I apologise I did not address you directly and if my communication was not as clear as it should have been.

    If you have a look at my message where I first mentioned the problem for the backend application, you’ll notice I said we have already fixed it by using the correct DLL - so problem was already fixed.

    My main concern is future proofing so that it would not happen again under a similar scenario.

    I understand changing it to be a “Package Reference/transient package” is one way to limit the risk, but as you mention the package cannot also be installed independently, which is plausible may happen in the future directly, or indirectly through installing a different package.

    Our main issue came when I had to roll back the version, but our deployer did not overwrite the more recent version of the DLL that was published - so we need to be more careful and have a different policy when doing any sort of roll back.

    I am basically trying to limit the possibility of having a block happen in a backend application, such a MessageBox to a user (as there is no user looking at it), when such a thing would be much nicer as an exception.

    Let me know if I missed anything, and thanks for your help.

    Kind Regards

    James

  • Posted 18 July 2024, 3:46 pm EST

    Hi James,

    I see your problem. I just tried to resolve the version conflict issue, but didn’t notice that you are trying to avoid future problems caused by version conflicts.

    Best regards

    Wolfgang

  • Posted 23 July 2024, 12:38 am EST

    Hello James,

    The developers have considered your request as an enhancement. We’ll update you once it has been implemented.

    [Internal ID: C1WIN-32704]

    Regards,

    Uttkarsh.

  • Posted 23 July 2024, 9:55 pm EST

    Hi Uttkarsh

    That’s great, thanks!

    Kind Regards

    James

Need extra support?

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

Learn More

Forum Channels