InvalidCastException after upgrading to .NET 8 and latest ComponentOne WinForms

Posted by: dev on 17 November 2025, 7:53 am EST

  • Posted 17 November 2025, 7:53 am EST

    Hello,

    After migrating our WinForms application to .NET 8 (from net 4.8) and upgrading to the latest ComponentOne WinForms assemblies, we are encountering a runtime error related to the legacy C1List control.

    Here is the exception we receive when opening any form that contains a C1List:

    System.InvalidCastException: Unable to cast object of type 'C1.Win.List.Split' to type 'C1.Win.List.ListBoxView'.
       at C1.Win.List.C1List.OnHandleCreated(EventArgs e)
       at System.Windows.Forms.Control.WmCreate(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at C1.Win.List.ListBase.Frame.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)


    This issue appears immediately during control initialization (HandleCreated), before any of our own code is executed.

    What we have already tested:

    1. All ComponentOne assemblies (C1.Win.*) are on the same version.

    2. A clean rebuild of the project.

    3. Re-adding the references manually from the ComponentOne installation folder.

    Could you confirm whether this casting error (Split → ListBoxView) is a known issue in the latest release?

  • Posted 18 November 2025, 6:09 am EST

    Hello,

    We are sorry but we did not observe any such errors at our end. We created a simple sample with C1List controls from C1.Win.List 8.0.20251.721: https://www.nuget.org/packages/C1.Win.List/8.0.20251.721.

    Sample: List_Sample.zip

    When you mention “re-adding the references manually from the ComponentOne installation folder,” could you clarify which folder you’re referring to?

    If you’re still pointing to the old .NET Framework 4.8 C1 assembly folder, please remove those references. For .NET 6/8 projects, you should only use the ComponentOne NuGet packages.

    The .NET Framework assemblies aren’t compatible with or supported in .NET 6/8 applications.

    If you still face any issues, please share the following:

    1. *.designer.cs file code related to C1 controls.
    2. All C1 references in your project along with their exact version.
    3. Folder path from where you pick C1 DLLs.

    Regards,

    Uttkarsh.

Need extra support?

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

Learn More

Forum Channels