ShowDialog hangs when used in Script Task on Vista
On Vista SP1, Framework 3.5 installed, means also KB110806 (automatically by Windows update) Simple project in SQL Server BI Development Studiojust one script task with variable FileName as R/W variable and following code:' Microsoft SQL Server Integration Services Script Task' Write scripts using Microsoft Visual Basic' The ScriptMain class is the entry point of the Script Task.Imports SystemImports System.DataImports System.MathImports System.Windows.FormsImports Microsoft.SqlServer.Dts.RuntimePublic Class ScriptMain' The execution engine calls this method when the task executes.' To access the object model, use the Dts object. Connections, variables, events,' and logging features are available as static members of the Dts class.' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.' ' To open Code and Text Editor Help, press F1.' To open Object Browser, press Ctrl+Alt+J.Public Sub Main()'' Add your code here'Dim fdlg As OpenFileDialogMsgBox("I am displaying")fdlg = New OpenFileDialog()fdlg.Title = "Data File (AXA)"fdlg.InitialDirectory = ""fdlg.Filter = "All Excel files|*.xls"fdlg.FilterIndex = 2fdlg.RestoreDirectory = TrueMsgBox("I am still displaying")If (fdlg.ShowDialog() = DialogResult.OK) ThenDts.Variables("FileName").Value = fdlg.FileNameDts.TaskResult = Dts.Results.SuccessElseDts.TaskResult = Dts.Results.FailureEnd IfMsgBox("I would love to be displayed")End SubEnd Classright click on script task, execute task Actual Results MsgBox("I am displaying"): okMsgBox("I am still displaying"): okno file dialog boxno MsgBox("I would love to be displayed") Expected Results showing file dialog boxshowing last msgbox(as on Windows server 2003)
June 22nd, 2008 3:10pm

I ran into this myself, also on Vista SP1. My code had worked fine until the first time I tried to run it after installing SP1.I just tried a bunch of stuff and it finally started working again. There are some bool type parameters which have to be initialized for OpenFileDialog and SaveFileDialog before the ShowDialog() method will work.When I say that it "hangs" I mean that the dialog does not display but no exception is thrown and the system eventually throws in a little wait cursor to indicate that the program is getting time. It doesn't hang the entire computer, fortunately, but the application has to be terminated.For OpenFileDialog the ShowHelp property must be explicitly set.For SaveFileDialog the ShowHelp, CreatePrompt, and OverwritePrompt properties must be explicitly set. It's not consistent though. I've had SaveFileDialog work with just ShowHelp set in simple situations. But I have an app which didn't start running again until I also set CreatePrompt and OverwritePrompt properties then it started working again. They don't have to be set to true, they just have to be initialized to either true or false. OpenFileDialog ofd = new OpenFileDialog(); ofd.ShowHelp = true; Console.WriteLine("Showing OpenFileDialog"); ofd.ShowDialog(); // Hangs if ShowHelp is not set. Console.WriteLine("ShowDialog Done"); SaveFileDialog sfd = new SaveFileDialog(); sfd.ShowHelp = true; sfd.CreatePrompt = true; sfd.OverwritePrompt = true; Console.WriteLine("Showing SaveFileDialog"); sfd.ShowDialog(); // Hangs if some or all of the parameters above are not set. Console.WriteLine("ShowDialog Done");I hope this helps. It's really nasty when you apply an OS "Fix" and your programs can no longer save their output.
Free Windows Admin Tool Kit Click here and download it now
August 11th, 2008 3:39am

Using OpenFileDialog.. Just added (<ofd>.ShowHelp = true) to my SSIS script (SQL Server 2005/SP3 & Vista Ultimate/ SP1),and my hanging <ofd>.ShowDialog() is now (Miraculously) visible!Many thanks for this
June 6th, 2009 5:05am

Thank you, tonyeminem ! setting showhelp to true solved my problem in BIDS 2008!
Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2009 10:46pm

You are really a genius.... This ShowHelp really works even for VS2010. Thanks a lot
October 2nd, 2011 2:22am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics