Note that there are some explanatory texts on larger screens.

plurals
  1. POInternetSetOption deadlock?
    primarykey
    data
    text
    <p>I have an application which uses Webbrowser control to navigate to a few vendor sites and scrape reporting. Because there are several accounts with one vendor, I need to have the browser end its session and clear any set cookies. I am using API calls to wininet.dll for both and am able to achieve the desired result. However, intermittently, I get what appears to be a deadlock on the InternetSetOption for INTERNET_OPTION_END_BROWSER_SESSION.</p> <p>It is very linear code and InternetSetOption is called from a single thread in one place. What makes it difficult to figure out is that while running in debug, I've only very rarely been able to reproduce the problem. As soon as I compile and run outside of VS, it will happen shortly after. I isolated it to that by pumping messages to the console as it runs. </p> <p>The few times I've been able to catch the problem while debugging, it just shows InternetSetOption as the next statement and sits, no exceptions or errors, nothing in the output window. InternetSetOption should return boolean, but the program will go no further and I never get any return from the API call. I tried look at the last error message thrown, but in this case it doesnt help, as it never throws an error.</p> <p>Anyone have any input as to what I can further do to debug this? </p> <p>Declared as:</p> <pre><code>[DllImport("wininet.dll", SetLastError = true, CharSet = CharSet.Auto)] private static extern bool InternetSetOption( IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength); </code></pre> <p>And called by:</p> <pre><code>InternetSetOption(IntPtr.Zero, 42, IntPtr.Zero, 0); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload