StiCompiler.Compile throws COMException

Stimulsoft Reports.NET discussion
Post Reply
FrankFroese
Posts: 6
Joined: Tue Jan 02, 2007 8:25 am
Location: Starnberg, Germany

StiCompiler.Compile throws COMException

Post by FrankFroese »

We are running Stimulsoft Reports.Net for many years on lots of computers. In our reports we use the compile mode. Currently we are running an older Reports.Net version 2020.4.2.0.

On most of our computers everything is running fine and without any problems. But on some Win11 Dell PCs within our application StiCompiler.Compile() throws a COMException (0xD0000003). Even the original stimulsoft designer cannot compile on this computers.

I think it must have to do with some policy settings on these computers. But I can't find settings that are responisble for this exception. UMCI (user mode code integrity) is on audit mode.

Any idea, where I can search for the reason of these COMException?

Code: Select all

System.Runtime.InteropServices.COMException: Ausnahme von HRESULT: 0xD0000003
   bei System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   bei System.CodeDom.Compiler.FileIntegrity.MarkAsTrusted(SafeFileHandle safeFileHandle) 
   bei Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources) 
   bei Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources) 
   bei System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources) 
   bei Stimulsoft.Base.StiCompiler.Compile(String textToCompile, String outputAssembly, LanguageType languageType, StiOutputType outputType, String[] referencedAssemblies, List`1 resources)
Frank
Lech Kulikowski
Posts: 7707
Joined: Tue Mar 20, 2018 5:34 am

Re: StiCompiler.Compile throws COMException

Post by Lech Kulikowski »

Hello,

System.Runtime.InteropServices.COMException (HRESULT: 0xD0000003) when using CodeDomProvider in .NET usually occurs because Windows security blocks the compiler from marking temporary compiled files (.dll/.exe) as trusted.

Most common causes:
Antivirus/EDR (e.g., Microsoft Defender) blocking "csc.exe" from creating or trusting files in %TEMP%.
Restricted Temp folder permissions (AppLocker, limited user rights, or strict security policies).
Typical fixes:
* Add the application Temp folder or "csc.exe" to antivirus exclusions.
* Ensure the process has write permissions to the %TEMP% directory or configure a custom temp directory for compilation.

Try to specify the path for the Compile() method:
report.Compile(path)

Thank you.
Post Reply