Hello,
when I run this method from a runbasebatch class I get the following exception error in the calling new() method, if I run from a Job I get not errors.
Object 'CLRObject' could not be created
Any idea?
from runbasebatch: LSP_FileManager::writeFileStream(fileName, content); (this class has calledfrom property)
server static void writeFileStream(str _fileName, str _content)
{
System.IO.StreamWriter sw;
InteropPermission perm = new InteropPermission(InteropKind::ClrInterop);
;
perm.assert();
sw = new System.IO.StreamWriter(_fileName, false);
sw.Write(_content);
sw.Flush();
sw.Close();
sw.Dispose();
CodeAccessPermission::revertAssert();
}
where _filename is '\\se-srv3\mydir\filetest.txt'
and the job:
server static void job15_writefilestream()
{
System.IO.StreamWriter sw;
InteropPermission perm = new InteropPermission(InteropKind::ClrInterop);
str _fileName = @'\\Se-srv3\mydir\filetest.txt';
str _content ="A";
;
perm.assert();
sw = new System.IO.StreamWriter(_fileName, false);
sw.Write(_content);
sw.Flush();
sw.Close();
sw.Dispose();
CodeAccessPermission::revertAssert();
}