<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcSDE connection timeout .NET in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134962#M3482</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If an invalid value for a connection string is passed to SDEWorkspaceFactory.OpenFromString(), the call hangs:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IWorkspaceFactory workspaceFactory = _workspaceFactory.OpenFromString("InvalidConnectionString", 0);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;If I break execution, I can see from the call stack that control is still with the unmanaged code. Unfortunately, this &lt;SPAN style="font-style:italic;"&gt;OpenFromString&lt;/SPAN&gt; doesn't offer a timeout. What I need to do is, within my .NET managed code, cancel the call to &lt;SPAN style="font-style:italic;"&gt;OpenFromString&lt;/SPAN&gt; after a certain timeout period. I've tried a couple of approaches, including the following:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Task&amp;lt;IWorkspace&amp;gt; task = new Task&amp;lt;IWorkspace&amp;gt;(() =&amp;gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _workspaceFactory.OpenFromString("InvalidConnectionString", 0); 
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
if (!task.Wait(10000))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new TimeoutException();
}
IWorkspace workspace = task.Result;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In this case, &lt;SPAN style="font-style:italic;"&gt;task.Wait()&lt;/SPAN&gt; always returns false, and &lt;SPAN style="font-style:italic;"&gt;task.Result()&lt;/SPAN&gt; is always &lt;SPAN style="font-style:italic;"&gt;null&lt;/SPAN&gt;, even if a valid value for the connection string is passed.&lt;BR /&gt;&lt;BR /&gt;I've also tried the following approach:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IWorkspace workspace = null;
Thread thread = new Thread(() =&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; workspace = _workspaceFactory.OpenFromString("InvalidConnectionString", 0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
thread.Start();
if (!thread.Join(10000))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new TimeoutException();
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In this case, if a valid value for the connection string is passed, execution works as expected, but if an invalid value is passed, the execution still hangs in the unmanaged code, and &lt;SPAN style="font-style:italic;"&gt;thread.Join()&lt;/SPAN&gt; never returns.&lt;BR /&gt;&lt;BR /&gt;Any suggestions on how to do this?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does it hang indefinitely?&amp;nbsp; The way I usually handle timeouts / invalid connection strings is to put the connection logic into a try block, which eventually should be caught:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IWorkspace _workspace;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _workspace = workspaceFactory.OpenFromFile(this.Path, 0);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Marshal.ReleaseComObject(workspaceFactory);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new BadDatabaseConnectionException("Unable to connect to database");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, (I dont have a lot of experience with the Thread in .NET), be careful multithreading with ArcObjects... if you create or access your workspace (or any ArcObject) from one thread, and try to use it on another, you will see some problems (STA).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:32:42 GMT</pubDate>
    <dc:creator>KevinYanuk</dc:creator>
    <dc:date>2021-12-11T07:32:42Z</dc:date>
    <item>
      <title>ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134961#M3481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If an invalid value for a connection string is passed to SDEWorkspaceFactory.OpenFromString(), the call hangs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;IWorkspaceFactory workspaceFactory = _workspaceFactory.OpenFromString("InvalidConnectionString", 0);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I break execution, I can see from the call stack that control is still with the unmanaged code. Unfortunately, this &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;OpenFromString&lt;/SPAN&gt;&lt;SPAN&gt; doesn't offer a timeout. What I need to do is, within my .NET managed code, cancel the call to &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;OpenFromString&lt;/SPAN&gt;&lt;SPAN&gt; after a certain timeout period. I've tried a couple of approaches, including the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Task&amp;lt;IWorkspace&amp;gt; task = new Task&amp;lt;IWorkspace&amp;gt;(() =&amp;gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _workspaceFactory.OpenFromString("InvalidConnectionString", 0); 
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
if (!task.Wait(10000))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new TimeoutException();
}
IWorkspace workspace = task.Result;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;task.Wait()&lt;/SPAN&gt;&lt;SPAN&gt; always returns false, and &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;task.Result()&lt;/SPAN&gt;&lt;SPAN&gt; is always &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;, even if a valid value for the connection string is passed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've also tried the following approach:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;IWorkspace workspace = null;
Thread thread = new Thread(() =&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; workspace = _workspaceFactory.OpenFromString("InvalidConnectionString", 0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
thread.Start();
if (!thread.Join(10000))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new TimeoutException();
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, if a valid value for the connection string is passed, execution works as expected, but if an invalid value is passed, the execution still hangs in the unmanaged code, and &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;thread.Join()&lt;/SPAN&gt;&lt;SPAN&gt; never returns.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions on how to do this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Mar 2014 21:57:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134961#M3481</guid>
      <dc:creator>JonathanBailey</dc:creator>
      <dc:date>2014-03-30T21:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134962#M3482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If an invalid value for a connection string is passed to SDEWorkspaceFactory.OpenFromString(), the call hangs:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IWorkspaceFactory workspaceFactory = _workspaceFactory.OpenFromString("InvalidConnectionString", 0);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;If I break execution, I can see from the call stack that control is still with the unmanaged code. Unfortunately, this &lt;SPAN style="font-style:italic;"&gt;OpenFromString&lt;/SPAN&gt; doesn't offer a timeout. What I need to do is, within my .NET managed code, cancel the call to &lt;SPAN style="font-style:italic;"&gt;OpenFromString&lt;/SPAN&gt; after a certain timeout period. I've tried a couple of approaches, including the following:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Task&amp;lt;IWorkspace&amp;gt; task = new Task&amp;lt;IWorkspace&amp;gt;(() =&amp;gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _workspaceFactory.OpenFromString("InvalidConnectionString", 0); 
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
if (!task.Wait(10000))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new TimeoutException();
}
IWorkspace workspace = task.Result;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In this case, &lt;SPAN style="font-style:italic;"&gt;task.Wait()&lt;/SPAN&gt; always returns false, and &lt;SPAN style="font-style:italic;"&gt;task.Result()&lt;/SPAN&gt; is always &lt;SPAN style="font-style:italic;"&gt;null&lt;/SPAN&gt;, even if a valid value for the connection string is passed.&lt;BR /&gt;&lt;BR /&gt;I've also tried the following approach:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IWorkspace workspace = null;
Thread thread = new Thread(() =&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; workspace = _workspaceFactory.OpenFromString("InvalidConnectionString", 0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
thread.Start();
if (!thread.Join(10000))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new TimeoutException();
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In this case, if a valid value for the connection string is passed, execution works as expected, but if an invalid value is passed, the execution still hangs in the unmanaged code, and &lt;SPAN style="font-style:italic;"&gt;thread.Join()&lt;/SPAN&gt; never returns.&lt;BR /&gt;&lt;BR /&gt;Any suggestions on how to do this?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does it hang indefinitely?&amp;nbsp; The way I usually handle timeouts / invalid connection strings is to put the connection logic into a try block, which eventually should be caught:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IWorkspace _workspace;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _workspace = workspaceFactory.OpenFromFile(this.Path, 0);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Marshal.ReleaseComObject(workspaceFactory);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new BadDatabaseConnectionException("Unable to connect to database");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, (I dont have a lot of experience with the Thread in .NET), be careful multithreading with ArcObjects... if you create or access your workspace (or any ArcObject) from one thread, and try to use it on another, you will see some problems (STA).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:32:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134962#M3482</guid>
      <dc:creator>KevinYanuk</dc:creator>
      <dc:date>2021-12-11T07:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134963#M3483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, it hangs indefinitely.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 12:42:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134963#M3483</guid>
      <dc:creator>JonathanBailey</dc:creator>
      <dc:date>2014-04-02T12:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134964#M3484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, it hangs indefinitely.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 18:19:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134964#M3484</guid>
      <dc:creator>JonathanBailey</dc:creator>
      <dc:date>2014-04-02T18:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134965#M3485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Yes, it hangs indefinitely.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would try to see if you get the same result from a single thread, and putting your code in a try catch block to see if you can catch any kind of exception thrown by the invalid connection string.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 19:13:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134965#M3485</guid>
      <dc:creator>KevinYanuk</dc:creator>
      <dc:date>2014-04-02T19:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134966#M3486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's no exception thrown.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the SDEWorkspaceFactory receives an invalid connection string or incomplete connection parameters, it opens up a dialog prompting the user for additional connection parameters. This seems to be a poor design, as it assumes that it will be used in an application in which there will be user interaction. In some cases, there is no interaction, and really an exception should be thrown if there are incomplete connection parameters.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 19:53:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134966#M3486</guid>
      <dc:creator>JonathanBailey</dc:creator>
      <dc:date>2014-04-02T19:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134967#M3487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;There's no exception thrown.&lt;BR /&gt;&lt;BR /&gt;If the SDEWorkspaceFactory receives an invalid connection string or incomplete connection parameters, it opens up a dialog prompting the user for additional connection parameters. This seems to be a poor design, as it assumes that it will be used in an application in which there will be user interaction. In some cases, there is no interaction, and really an exception should be thrown if there are incomplete connection parameters.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've received a dialog box when opening SDE connections only when the authentication type is user/pass and not OSA, or if the user credentials are not passed into the workspace through a property set:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; IPropertySet propertySet = new PropertySetClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp; propertySet.SetProperty("SERVER", server);
&amp;nbsp;&amp;nbsp;&amp;nbsp; propertySet.SetProperty("INSTANCE", instance);
&amp;nbsp;&amp;nbsp;&amp;nbsp; propertySet.SetProperty("DATABASE", database);
&amp;nbsp;&amp;nbsp;&amp;nbsp; propertySet.SetProperty("USER", user);
&amp;nbsp;&amp;nbsp;&amp;nbsp; propertySet.SetProperty("PASSWORD", password);
&amp;nbsp;&amp;nbsp;&amp;nbsp; propertySet.SetProperty("VERSION", version);

&amp;nbsp;&amp;nbsp;&amp;nbsp; Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
&amp;nbsp;&amp;nbsp;&amp;nbsp; IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
&amp;nbsp;&amp;nbsp;&amp;nbsp; workspaceFactory.Open(propertySet, 0);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure how your connection string is formatted.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:32:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134967#M3487</guid>
      <dc:creator>KevinYanuk</dc:creator>
      <dc:date>2021-12-11T07:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134968#M3488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can't guarantee that the connection method will be OSA; it might be database. I'm relying on clients of my code to provide a valid connection string, so it might be a passage from &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Finnegans Wake&lt;/SPAN&gt;&lt;SPAN&gt; for all I know. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I could write a bunch of code to validate the connection string passed, but my thinking is that this is something that Esri should be checking and returning an error for. Since it doesn't seem that Esri does this, I was hoping to find a way to timeout and throw an exception, rather than having to write and maintain a whole bunch of string validation code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 11:53:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134968#M3488</guid>
      <dc:creator>JonathanBailey</dc:creator>
      <dc:date>2014-04-03T11:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134969#M3489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I can't guarantee that the connection method will be OSA; it might be database. I'm relying on clients of my code to provide a valid connection string, so it might be a passage from &lt;SPAN style="font-style:italic;"&gt;Finnegans Wake&lt;/SPAN&gt; for all I know. &lt;BR /&gt;&lt;BR /&gt;I could write a bunch of code to validate the connection string passed, but my thinking is that this is something that Esri should be checking and returning an error for. Since it doesn't seem that Esri does this, I was hoping to find a way to timeout and throw an exception, rather than having to write and maintain a whole bunch of string validation code.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yeah... such is often the case with ArcObjects... sorry I can't be of more help.&amp;nbsp; I'll often find writing my own solution for these things work out better in the end, anyway.&amp;nbsp; I'm still struggling to get a Java ArcMap addin to even show up in the commands window after its been installed!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 12:12:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134969#M3489</guid>
      <dc:creator>KevinYanuk</dc:creator>
      <dc:date>2014-04-03T12:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: ArcSDE connection timeout .NET</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134970#M3490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can't guarantee that the connection method will be OSA; it might be database. I'm relying on clients of my code to provide a valid connection string, so there's a chance that it might be gibberish. I could write a bunch of code to validate the connection string passed, but my thinking is that this is something that Esri should be checking and returning an error for.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2014 12:25:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/arcsde-connection-timeout-net/m-p/134970#M3490</guid>
      <dc:creator>JonathanBailey</dc:creator>
      <dc:date>2014-04-03T12:25:40Z</dc:date>
    </item>
  </channel>
</rss>

