.NET Marshalling not working?

Hello,

The follow code is has a basic string (str) datatype in AX that has a value which is supposed to be passed to the .NET String object. The marshaling is supposed to happen automatically, at least thats what I understand. Yet, what occurs is that the value of the string is “new” in every case. Any thoughts?

private void importFileData(str _fileName, FlatFileType _flatFileType, container _conDir)

{

int idx = 1;

str filePrefix;

FlatFileType flatFileType;

System.String fileName;

;

new InteropPermission(InteropKind::ClrInterop).assert();

while(conLen(_conDir) >= idx)

{

fileName = _fileName;

filePrefix = subStr(_fileName, 0, strLen(_fileName) - 3);

if (flatFileType == FlatFileType::ZIP && fileName.Contains(filePrefix))

{

pause;

}

idx++;

}

CodeAccessPermission::revertAssert();

}