LINQ Reporting Engine - Common Language Runtime detected an invalid program

Hello,

I am encountering an exception after upgrading to Aspose.Words.NET v22.3.0 (from v21.10.0)

Unhandled exception. System.InvalidOperationException: An error has been encountered while evaluating the expression or statement ‘data.Contains("")]>’. Common Language Runtime detected an invalid program.
—> System.InvalidProgramException: Common Language Runtime detected an invalid program.
at _6641e7047f4f43e1ab08ce78b88e83d4. ( , Object , Object , Object )
at .( , , [] )
at ()
at ()
— End of inner exception stack trace —
at ()
at .()
at .()
at . ( , , IDictionary , )
at .( , IDictionary , )
at . ( , , IDictionary , )
at .( , IDictionary , )
at . ( , , IDictionary , )
at .( , IDictionary , )
at . ( )
at . ( , )
at .(String[] , Object[] , ,​ , , )
at .(String[] , Object[] , , )
at Aspose.Words.Reporting.ReportingEngine.BuildReport(Document document, Object[] dataSources, String[] dataSourceNames)
at Aspose.Words.Reporting.ReportingEngine.BuildReport(Document document, Object dataSource, String dataSourceName)
at Aspose.Words.Reporting.ReportingEngine.BuildReport(Document document, Object dataSource)
at Program.$(String[] args) in C:\Workspace\Data\Temp\AsposeTest\Program.cs:line 7

I have attached a sample of this exception:
AsposeTest.zip (660 Bytes)

run with dotnet run

using Aspose.Words;
using Aspose.Words.Reporting;

var doc = new Document();
new DocumentBuilder(doc).Writeln("<<foreach [data in Values]>><<if [data.Contains(\"\")]>><</if>><</foreach>>");

new ReportingEngine().BuildReport(doc, new Data());

public class Data
{
    public string[] Values { get; set; } = new[] { "" };
}

Can you confirm this is a bug with this version of Aspose.Word? Version 21.10 seems to work OK.

thanks.

@D-motivatie

We were able to reproduce the issue using Aspose.Words for .NET 22.3 when running in .NET 6 (it is not reproducible in .NET 5, for example). The issue is logged as WORDSNET-23661 into our tracking system. You will be notified through the forum thread, once it is resolved.

As a temporary workaround, you can disable reflection optimization before building a report as follows:

ReportingEngine.UseReflectionOptimization = false;

For information on reflection optimization, see Optimizing Reflection Calls.

The issues you have found earlier (filed as WORDSNET-23661) have been fixed in this Aspose.Words for .NET 22.5 update also available on NuGet.