janisito
Posts: 78
Joined: Thu Apr 09, 2015 6:28 am

Action data maximum length?

Hi,

When I pass a large string (around 300 characters) through action data (using installer properties) to a custom action that runs deferred some the string seems to be missing. Is there a maximum length that can be passed? Or is there a maxmum length what each install parameter can be?

Thanks,

Regards
Jan
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Action data maximum length?

Hello Jan,

As far as I know, there should not be any limit to a property size (in terms of characters). Since MSI is just a database, properties are stored in "Property" table, which consists of the following columns: "Property" and "Value".

The "Value" column is of the "Text" type, which means there is no restriction on the number of characters in a property. However, there is a restriction on the number of characters of a property name (which is 72, if I am not mistaken).

Could you please give me a test case so I can try to reproduce this on my end? Also, I think that a log file of the installation process where a part of your string is missing may also be helpful.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
janisito
Posts: 78
Joined: Thu Apr 09, 2015 6:28 am

Re: Action data maximum length?

Hi Catalin,

Thank you for your reply. I think I have found the issue. The action data I pass to my custom action looks simplified like this:

[PARAM_1]|[PARAM_2]|[PARAM_3]|[PARAM_4]|[PARAM_5]

In the custom action I get the string like so: string customData = session.CustomActionData.ToString();

Each PARAM_X contains a connection string with the following format: "server=1.2.3.4;uid=hello;pwd=world;database=test;trusted_connection=no".

Since I have more than one connection string is seems that having the same key/value more than once messes things up. The only solution I can think of is base64 encoding the whole thing before putting the data into the install parameters. I thought custom data was just text?

Regards
Jan
janisito
Posts: 78
Joined: Thu Apr 09, 2015 6:28 am

Re: Action data maximum length?

Hmmm... I found it. My bad.

Incorrect way:
string actionData = session.CustomActionData.ToString();

Correct way:
string actionData = session["CustomActionData"];

They will differ. The incorrect way will treat the whole string as key/value and omit duplicate ones. Took me some hours to figure this out. :(
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Action data maximum length?

Hello Jan,

Yes, indeed, you are right, the correct way to get a custom action value in C# is like this:

Code: Select all

type variable = session["Property"]
For more information about this, you can have a look on our "How to set an installer property using custom actions" article.

Anyway, I am glad you sorted things out.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
janisito
Posts: 78
Joined: Thu Apr 09, 2015 6:28 am

Re: Action data maximum length?

Thank you!
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Action data maximum length?

You are always welcome, Jan.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”