Theo Harper created AMQNET-852:
----------------------------------

             Summary: Culture-sensitive LastIndexOf causes 
ArgumentOutOfRangeException in Session constructor when thread culture is 
non-English (.NET 5+)
                 Key: AMQNET-852
                 URL: https://issues.apache.org/jira/browse/AMQNET-852
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: MSMQ
    Affects Versions: API-2.2.0
         Environment: Linux / Thai Locale
            Reporter: Theo Harper


We are seeing unexpected {{System.ArgumentOutOfRangeException}} errors during 
construction of {{Apache.NMS.ActiveMQ.Session}} when running under certain 
non-English cultures. The issue is caused by the use of *culture-sensitive 
string APIs* inside the library, specifically {{LastIndexOf(")")}} on 
{{{}brokerUri.Query{}}}, which returns different results under different 
cultures in .NET 5+ due to ICU globalization changes.

When the application runs under a non-English culture (e.g., {*}fr-FR{*}, 
{*}zh-CN{*}, etc.), the following exception occurs:
System.ArgumentOutOfRangeException: startIndex cannot be larger than length of 
string. (Parameter 'startIndex')
This originates from:
{{brokerUri.Query.LastIndexOf(")")}}
which returns an unexpected index, causing:
{color:#000000}Substring(brokerUri.Query.LastIndexOf({color}{color:#000000}")"{color}{color:#000000})
 + {color}{color:#000000}1{color}{color:#000000}){color}
to attempt to start beyond the string boundary.

Under {*}en-US culture{*}, no exception occurs.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to