title: Multiple threads accessing UniData from UniObjects.NET throws UNI RPC error
body: <p>We've been using UniObjects.NET without issue until we started using it with BizTalk which is a multithreaded product. The issue is the error below. This error only happens on the 2nd thread (and probably 3rd, 4th etc. threads). The 1st thread connects and is able to retreive data from UniData just fine. The error doesn't say much and a search only returns one result not dealing with our particular issue. Does anyone have an anwser or can point me in the right direction? This error is without connection pooling turned on and we aren't using connection pooling as that throws other errors.</p>
  
  <p>Another thing to note is that is that during debugging we wrote some code that each thread would write to a seperate file some debugging information. Just the act of writing debug info to a file made both threads work correctly. I don't believe this is a connection timing issue (i.e. opening the UniSession at the same time) as it only fails at the point of accessing the UniData File at the same time (assuming at the same time).</p>
  
  <p>The <a href="http://www.rocketsoftware.com/u2/products/universe/resources/technical-manuals/universe-v11r1/uonet-v11r1.pdf" rel="nofollow">UniObjects.NET document</a> for the 2.2.3.7377 (May 2010) file version of UniObjects.NET we are using. UniData version is 7.2.</p>
  
  <p><strong>UPDATE:</strong> Also tried with UniObjects.NET version 2.2.5.7463 and it still throws same exception.</p>
  
  <pre>
  Inner exception: GetX - Error with file 'MYFILEX'. [IBM U2][UODOTNET - UNIRPC][ErrorCode=81004] An argument was requested from the RPC that was of an invalid type
  
  Exception type: Exception
  Source: MyBusinessObjects
  Target Site: System.Collections.Generic.List`1[MyBusinessObjects.XResponse] GetX(System.Collections.Generic.List`1[MyBusinessObjects.Lookup])
  The following is a stack trace that identifies the location where the exception occured
    at MyBusinessObjects.Lookups.GetX(List`1 Lookups)
    at MyBusinessObjects.Integration.GetXResponses(XmlDocument xml, String header, String gheader)
    at Orchestrations.XProcess.segment1(StopConditions stopOn)
    at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
  </pre>
  
  <p><strong>UPDATE:</strong> Same Error dealing with reading lists.</p>
  
  <pre>
  Inner exception: [IBM U2][UODOTNET - UNIRPC][ErrorCode=81004] An argument was requested from the RPC that was of an invalid type
  
  Exception type: UniRPCPacketException
  Source: 
  UniRPCPacket Class
  Target Site: Byte[] ReadByteArray(Int32)
  The following is a stack trace that identifies the location where the exception occured
  
     at IBMU2.UODOTNET.UniRPCPMessage.ReadByteArray(Int32 anIndex)
     at IBMU2.UODOTNET.UniSelectList.ReadList()
     at IBMU2.UODOTNET.UniSelectList.ReadListAsStringArray()
     at MyBusinessObjects.Lookups.GetY()
     at MyBusinessObjects.Integration.GetResponses(XmlDocument xml, String header, String gsheader)
     at Orchestrations.Process.segment1(StopConditions stopOn)
     at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
  </pre>