[Bug] RadSaveFileDialog

1 Answer 10 Views
FileDialogs
Camille
Top achievements
Rank 1
Camille asked on 02 Oct 2025, 07:37 AM | edited on 02 Oct 2025, 07:37 AM

Hi,

Using SaveFileDialog (not RadSaveFileDialog) in Telerik apps is broken.

I'm using the [STAThread] attribute on my Program.cs.

When running my app in Debug mode , I get the following exception when ShowDialog is called  :

   à System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)

   à System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
   à NDC.WinUI.Helpers.WinDbFileHelper.<ExportDB>d__4.MoveNext()

When trying the same in Release mode, my app simply freezes and does nothing.

Here is my code :


public static async Task<bool> ExportDB(string dbPath)
{
    try
    {
        if(File.Exists(dbPath))
        {
            List<DriveInfo> usbDrives = DriveInfo.GetDrives().Where(drive => drive.DriveType == DriveType.Removable && drive.IsReady).ToList();

            using(SaveFileDialog sfd = new SaveFileDialog()
            {
                DefaultExt = NdcConstants.SqLiteExtension.ExtensionFilter,
                InitialDirectory = usbDrives.Count != 0 ? usbDrives[0].RootDirectory.FullName : Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                Filter = NdcConstants.SqLiteExtension.FriendlyName,
                FileName = Path.GetFileName(dbPath),
                RestoreDirectory = true
            })
            {

                if(sfd.ShowDialog() == DialogResult.OK)
                {
                    if(File.Exists(sfd.FileName))
                    {
                        File.Delete(sfd.FileName);
                    }

                    await SqlFileBackup.ProcessOnlineBackup(dbPath, sfd.FileName);
                    return true;
                }
            }
        }

        return false;
    }
    catch(Exception ex)
    {
        Interaction.Error(ex);
        return false;
    }
}

Which is call like this : await WinDbFileHelper.ExportDB(settings.LocalDatabaseFullPath)

Base .Net SDK Dialog class should be able to work even if called inside a Telerik app/form.

Camille
Top achievements
Rank 1
commented on 02 Oct 2025, 07:38 AM

The ticket title should be SaveFileDialog, my apologies

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 02 Oct 2025, 11:12 AM

Hello Camille,

Thank you for clarifying that you are using the standard SaveFileDialog within a Telerik UI for WinForms application. The standard dialog should work correctly in this context, and Telerik controls do not interfere with its basic operation. To be honest, I am not sure how any of the Telerik controls could potentially break the SaveFileDialog. 

As far as I am aware, the MS SaveFileDialog (along with the rest of the file dialogs) should be called on the UI thread. You can check this StackOverflow thread where this was discussed: SaveFileDialog doesn't show in new thread? There are a couple of suggestions in the comments section. You can try them and see if they work for you.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Your perspective matters! Join other professionals in the State of Designer-Developer Collaboration 2025: Workflows, Trends and AI survey to share how AI and new workflows are impacting collaboration, and be among the first to see the key findings.
Start the 2025 Survey
Tags
FileDialogs
Asked by
Camille
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or