System.ArgumentNullException was unhandled by user code
HResult=-2147467261
Message=Value cannot be null.
Parameter name: expressions
ParamName=expressions
Source=System.Core
StackTrace:
at System.Linq.Expressions.Expression.RequiresCanRead(Expression expression, String paramName)
at System.Linq.Expressions.Expression.RequiresCanRead(IEnumerable1 items, String paramName)
at System.Linq.Expressions.Expression.Block(IEnumerable1 variables, IEnumerable1 expressions)
at System.Linq.Expressions.Expression.Block(IEnumerable1 expressions)
at Marten.Schema.BulkLoading.BulkLoader1..ctor(ISerializer serializer, DocumentMapping mapping, IdAssignment1 assignment)
at Marten.Schema.DocumentSchema.
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at Marten.Schema.DocumentSchema.BulkLoaderForT
at Marten.DocumentStore.bulkInsertDocumentsT
at Marten.DocumentStore.BulkInsertT
at CustomerManager.MainWindowViewModel.BulkInsert() in D:\ps\marten2\poc\m2\x\CustomerManager\MainWindowViewModel.cs:line 203
InnerException:
private void BulkInsert()
{
var randomCustomers = GenerateRandomCustomers();
App.Store.BulkInsert(randomCustomers, batchSize: 50);
}
private Customer[] GenerateRandomCustomers()
{
return Enumerable.Range(1, 100)
.Select(x => new Customer {FirstName = "Sarah", LastName = x.ToString(), Age = x}).ToArray();
}
Document type class:
[UseOptimisticConcurrency]
public class Customer : INotifyPropertyChanged
{
private int _id;
private string _firstName;
private string _lastName;
public int? Age { get; set; }
public int Id
{
get { return _id; }
set
{
_id = value;
OnPropertyChanged();
}
}
public string FirstName
{
get { return _firstName; }
set
{
_firstName = value;
OnPropertyChanged();
}
}
public string LastName
{
get { return _lastName; }
set
{
_lastName = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
@jason-roberts I'll take a look at this later today, thank you for the repro steps.
@jason-roberts I've got a local test that reproduces it.
Got it. The fix will be in v1.2.3 later today. This was clearly a permutation that we missed in testing.