Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

System.IndexOutOfRangeException: Index was outside the bounds of the array.

$
0
0

Hello,

I have a package that decrypts data and it uses C# in Script Transformation Editor. It has been running successfully in the past few days. However, it started to fail with the following error message:

Error: 0xC0047062 at DecryptTables, Decryption MyTableName [501]: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
   at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)
   at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100 wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket)
Error: 0xC0047022 at Table 93-100, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Decryption VerificationLog" (501) failed with error code 0x80131508 while processing input "Input 0" (513). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.
Information: 0x40043008 at Table 93-100, SSIS.Pipeline: Post Execute phase is beginning.

I looked into this post but I am not really sure where I need to make the correction:

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8d9720af-b4a0-48de-8225-dbe5065f0ecf/systemindexoutofrangeexception-index-was-outside-the-bounds-of-the-array?forum=sqlintegrationservices

And here is part of the script:

 public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        try
        {
            //for Comments column
            int length = (Int32)Row.Comments.Length;
            if (length == 0)
            {
                Row.DecryptComments = null;
            }
            else
            {
                byte[] bytes = Row.Comments.GetBlobData(0, length);
                String keyString = System.Text.Encoding.ASCII.GetString(bytes);
                if (keyString.Contains("\\r\\n"))
                {
                    keyString = keyString.Replace("\\r", "\r");
                    keyString = keyString.Replace("\\n", "\n");
                }
                else
                {
                    keyString = keyString.Replace("\\n", "\r\n");
                }


                Stream stream = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(keyString));
                Row.DecryptComments = getDecryptedData(stream, keyString);
            }

Thanks,


IN~


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>