Skip to content

BulkOptimizedAnalysis:IsOptimized throws InvalidOperationException #633

@Crossbow78

Description

@Crossbow78

[Using Z.EntityFramework.Extensions.EFCore 9.103.9.3]

When using the following code fragment to insert data into multiple tables:

    var result = await _dbContext.BulkInsertOptimizedAsync(data);
    _logger.LogInformation("IsOptimized: {IsOptimized}, Tips: {Tips}", result.IsOptimized, result.TipsText);

we see many log lines where the query result is reporting "IsOptimized: true", but for one particular table it results in the following exception on the _logger.LogInformation line:

System.InvalidOperationException: Nullable object must have a value.
   at System.Nullable`1.get_Value()
   at Z.EntityFramework.Extensions.BulkOptimizedAnalysis.get_IsOptimized()
   (...)

This is what I see in the debugger when I inspect the result value:
Image

I'm unsure what kind of obfuscation is going on here, but it's even more mysterious how a non-nullable boolean can throw this specific exception.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions