WinForms 导航事件

WinForms Navigated Event

我制作了一个 winForms 应用程序,它使用网络浏览器控件,使用户能够使用他的 google 或 facebook 帐户登录,然后在获取信息或任何错误或异常后,包含网络浏览器的表单关闭并将 return 返回到主窗体,我执行以下操作,准备请求,使用该请求的 navigate() 然后使用事件 Navigated 捕获响应。 在代码中一切正常,但是当我构建为 Release 并安装应用程序时,Navigated 事件永远不会被触发,这真的很奇怪,因为我的代码中没有任何东西处于调试状态,有什么解决这个问题的想法吗??

表单加载事件的代码是:

private void GoogleLogin_Load(object sender, EventArgs e)
    {
        AuthHelper authHelper = new AuthHelper();

        Uri loginURI = authHelper.GetGoogleAuthURI(_appID, redirectURI);
        GoogleLoginControl.Navigate(loginURI);
    }

Navigated 事件中 Web 浏览器控件的代码

private void GoogleLoginControl_Navigated(object sender, WebBrowserNavigatedEventArgs e)
    {
        CoreStaticMembers.ologger.LogToFile("Navigated event with the absolute URL "+ e.Url.AbsoluteUri );
        MessageBox.Show("Navigated event is fired");
        ///used if parameters are empty so ignore the following messages
        bool ignore = false;
        string code = null;

        if (e.Url.AbsolutePath.Equals("/connect/login_success.html"))
        {
            AuthHelper authHelper = new AuthHelper();
            //NameValueCollection parameters = HttpUtility.ParseQueryString(e.Url.Query);
            try
            {
                NameValueCollection parameters = HttpUtility.ParseQueryString(e.Url.Query);
                if (parameters != null)
                {
                    string jsonResponse = null;

然后我继续进行正常的身份验证和数据获取,请记住,只有当我构建为 Release 然后安装应用程序时才会出现此问题,甚至为 Web 浏览器控件触发导航,也是如此父窗体的加载事件 提前致谢

更新 顺便说一下,当我通过调用表单构造函数中的 Initialize 函数初始化表单时,我也尝试使用所需的 URL 进行导航,但出现了同样的问题,

我发现这个问题与 DLL 文件的兼容性问题有关,特别是 "Newtonsoft" DLL。