RasDialDialog.ShowDialog does not show when running under 64-bit windows with applications compiled for AnyCPU.

Oct 15, 2011 at 10:10 AM
Edited Oct 15, 2011 at 10:10 AM

If I compile an application for AnyCPU and run it under 64-bit windows 7, then the RasDialDialog.ShowDialog returns immediately with DialogResult.Cancel

If I compile for x86, then everything works fine.

This sounds similar to an issue with PrintDialog , but without the workaround . See for example http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/62aa5e1b-8846-47c0-8858-932031e79622/ 

 

Wasn't sure where to I should add this to the Issue Tracker, but decided not to since it is more likely an issue with Windows and/or the Dotnet Framework, but I thought I would mention it here in case any else comes across the issue.

Coordinator
Oct 15, 2011 at 4:40 PM

You did the right thing... if you're not sure if it's a bug, just open a discussion so we can talk about it and I can take care of moving it to a work item if it needs to be.

Are any errors being reported by the Error event on the component? If it fails, it should say why from that event.

- Jeff

Oct 19, 2011 at 8:40 PM

I don't see any errors or exception (not even internal exceptions).

In the RunDialog method of the RasDialDialog class it gets to the line

flag = DotRas.Internal.UnsafeNativeMethods.Instance.DialDlg(this.PhoneBookPath, this.EntryName, this.PhoneNumber, ref info);

and this returns with flag false and info.error == 0 
Coordinator
Oct 20, 2011 at 5:53 AM

Hmm, not what I was expecting. I looked at the structure used by the component and I didn't change the struct packing alignment to 4 like I had everywhere else so I expected to see a 632 error being thrown. Guess I'll have to create an issue work item and try to track it down and see whether I can fix it. It could be something I've done with the structs, or it could just be a problem with that particular API as you had shown.

Unfortunately the way that the UseEXDialog property on PrintDialog works is uses a secondary API that's exposed in Win32. Unfortunately the RasDialDlg API only has the one, so if I can't get it working in AnyCPU I might just have to make a note that the component is 32-bit only in the documentation.