开发者

WPF button action won't trigger if I have code referencing a WinForms project

I'm coding an Outlook 2010 plug-in in .NET 4.0, which use WPF technology, and am experiencing some wierd stuff. I'm trying to open a WinForms Form that resides in a referenced WinForms project. In the project for the Outlook plugin, this is the code for the action even开发者_如何学JAVAt (button click):

    public void SettingsButton_Click(IRibbonControl control)
    {
        MessageBox.Show("Hello world!");    // Breakpoint here 
        var form = new TestProject.Form1(); // WinForms project
        form.Show();
    }

This works perfectly if I comment out the two last lines in the method, but when they are present, the code never executes! If I set a breakpoint on line 1, Visual Studio never breaks! What??

I hate magic. I really do not hope WPF have some kind of runtime analysis of the code and finds out there is something in that method it doesn't like, and therefor does not execute it? It would make debugging a nightmare...

Can anyone give me any hints? I'd very much appreciate it.

I have done a test with a normal WPF project referencing a WinForms project, and that went perfectly fine.


Turns out the WinForms project was set to 32 bit architecture when the Office plugin was configured for x64.

...would be nice to get some kindof feedback from compiler and/or runtime error, though...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜