You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I used FastExpressionCompiler version 3.3.4 and everything worked. After updating to version 4.1.0 I started getting errors. I also use Mapster 7.4.0.
I was able to find the problem using a NUnit test
using FastExpressionCompiler;
using Mapster;
using NUnit.Framework;
namespace Garda.Unit.Tests.Mapster;
[TestFixture]
[Parallelizable(ParallelScope.Default)]
internal sealed class NullItemArrayFastExpressionCompilerTests
{
private sealed record ExportInfoDto(long[] Locations);
private sealed record ExportInfoModel(long?[] Locations);
private class ReportAdaptRule : TypeAdapterRule
{
internal ReportAdaptRule()
{
TypeAdapterConfig<ExportInfoModel, ExportInfoDto>
.NewConfig();
}
}
[TestCase(CompilerFlags.Default)]
[TestCase(CompilerFlags.NoInvocationLambdaInlining)]
[TestCase(CompilerFlags.EnableDelegateDebugInfo)]
[TestCase(CompilerFlags.ThrowOnNotSupportedExpression)]
public void NullItemArray(CompilerFlags compilerFlags)
{
// Arrange
var report = new ExportInfoModel(new long?[] { 1 });
TypeAdapterConfig.RulesTemplate.Add(new ReportAdaptRule());
TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileFast(flags: compilerFlags);
TypeAdapterConfig.GlobalSettings.Compile();
// Act
Assert.Throws<NullReferenceException>(() => report.Adapt<ExportInfoDto>());
}
}
If I change long?[] to long[] or return version 3.3.4 then the NullReferenceException will no longer occur
Hello. I used FastExpressionCompiler version 3.3.4 and everything worked. After updating to version 4.1.0 I started getting errors. I also use Mapster 7.4.0.
I was able to find the problem using a NUnit test
If I change long?[] to long[] or return version 3.3.4 then the NullReferenceException will no longer occur
Similar problems:
The text was updated successfully, but these errors were encountered: