ScriptBuffer.AddRow() inaccessible due to its protection level in async C# script component in SSIS

StackOverflow https://stackoverflow.com/questions/23391384

  •  12-07-2023
  •  | 
  •  

Domanda

I have an async script transformation component where I am parsing some XML from a database table in order to afterwards export the data in a different structure to another database table. It has been working fine so far, with calls to Output0Buffer.AddRow() and setting the outputbuffer's column values to output data. However, all of a sudden SSIS refuses to compile the script and marks my calls to Output0Buffer.AddRow() red, and says that

Error: 'Microsoft.SqlServer.Dts.Pipeline.ScriptBuffer.AddRow()' is inaccessible due to its protectionlevel

The call to AddRow() is still in the same place in the script and I haven't made any new calls.

From searching for an answer I've found two usual suspects for problems with the outpoutbuffer: the first is that the script component is synchronous, and the second is that accessors for whatever the user is trying to access are too restrictive. My script is still asynchronous, and I have not done any modifications to the accessors of AddRow() (which is a public method in BufferWrapper.cs). So none of these should be the problem!

What has changed however is that I have added new output-columns to the outputbuffer in the script transformation editor, and these outputs have names with periods in them, for example "1.10" (without quotation marks). When I type "Output0Buffer." and check the autocomplete list I can see the other outpout columns' names, but not the ones with periods in their names (these come last in the script transformation editor).

I'm thinking maybe the period is the problem, but I've been searching and can't seem to find an answer to which names are valid in SSIS script components' output columns. I also thought/hoped that SSIS would let me know in the script editor if the output column names were illegal, but it doesn't say anything about them there.

I don't want to change the output columns' names because there are alot of them, and I'm trying to use reflection to match data from the XML-blob to these output columns. The data in the XML-blob has these kinds of names (e.g. "1.10", without quotes), and I think it will be alot messier if the parsed data and the output columns can't have matching names.

So, what is causing the AddRow() call from being inaccessible?

È stato utile?

Soluzione

The problem was, as suspected, the naming of outpout columns. Renaming the columns solved the problem. Use column names that start with a letter and that don't contain periods!

I did som small tests with output column names. If the names for output columns begin with a number they are invisible inside the script component, and can thus not be used at all. If they begin with a letter but contain a period, only the part of the name up to, but not including, the period is visible in the autocomplete list. This made them useless to me, since I wanted to use reflection with the complete column name I had specified, but I am not sure if they can be used or not for other purposes.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top