FileInfo Type initializer not working in Trident 1.2.1

Dec 9, 2010 at 12:19 AM

Hi Trident Team, 

I've recently followed the instructions in the programming guide on creating a custom type initialiser. I  have used the same code as in the programming guide and when I use it in an activity (I have a dummy activity with one requiredInputParam which does nothing with the value) The workflow crashes even before the activity begins to execute. There error i receive is:

Execution of the workflow failed. Reason: CreateInstance failed for type 'System.IO.FileInfo'. No parameterless constructor defined for this object.

Any way to fix this?

Cheers,

David.

Dec 9, 2010 at 2:59 AM
Edited Dec 9, 2010 at 2:59 AM

I have tested the type initialiser with a custom FilePath type which is just a container for a string with a parameterless constructor. When I replace FileInfo with FilePath the workflows now run fine.

May 3, 2011 at 5:46 AM

HI,

 

Even i am having same issue while using FileInfo Type Initializer when i am trying to use it in activity which i have created. Can you please tell me how did you resolve this issue. 

 

Regards

Sumit

May 4, 2011 at 9:23 AM

Hi Sumit,

Did you try the solution suggested by David? Are you still facing the issue?

The error message (Execution of the workflow failed. Reason: CreateInstance failed for type 'System.IO.FileInfo'. No parameterless constructor defined for this object.) suggests that the FileInfo class does not have any constructor which takes zero parameter. In fact the FileInfo class has only one constructor defined which takes one string parameter, the path of the file.

FileInfo fi = new FileInfo (@"C:\Program Files");

So you need to create the Activity with an input parameter which you must provide (i.e. RequiredInput).

You can also find a sample project for FileInfoInitializer here.

Regards,
Support Team

May 19, 2011 at 11:32 AM

Hi Sumit,

Please let us know are you still facing the issue?

Regards,
Abhishek