Per @Hawxy at Discord conversation, NpgsqlTypeMapping is causing the issue when starting multiple Marten instances in parallel:
Object reference not set to an instance of an object.
at Weasel.Postgresql.PostgresqlProvider.<>c__DisplayClass15_0.<GetTypeMapping>b__0(NpgsqlTypeMapping mapping)
at System.Linq.Enumerable.TryGetLast[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Weasel.Postgresql.PostgresqlProvider.GetTypeMapping(Type type)
at Weasel.Postgresql.PostgresqlProvider.ResolveDatabaseType(Type type)
at Weasel.Postgresql.PostgresqlProvider.GetDatabaseType(Type memberType, EnumStorage enumStyle)
at Marten.Storage.Metadata.MetadataColumn`1..ctor(String name, Expression`1 property) in C:\Source\marten\src\Marten\Storage\Metadata\MetadataColumn.cs:line 100
at Marten.Storage.Metadata.LastModifiedColumn..ctor() in C:\Source\marten\src\Marten\Storage\Metadata\LastModifiedColumn.cs:line 10
at Marten.Schema.DocumentMetadataCollection..ctor(DocumentMapping parent) in C:\Source\marten\src\Marten\Schema\DocumentMetadataCollection.cs:line 14
at Marten.Schema.DocumentMapping..ctor(Type documentType, StoreOptions storeOptions) in C:\Source\marten\src\Marten\Schema\DocumentMapping.cs:line 81
at Marten.Schema.DocumentMapping`1..ctor(StoreOptions storeOptions) in C:\Source\marten\src\Marten\Schema\DocumentMapping.cs:line 665
at Marten.DocumentMappingBuilder`1.Build(StoreOptions options) in C:\Source\marten\src\Marten\MartenRegistry.cs:line 47
at Marten.Storage.StorageFeatures.Build(Type type, StoreOptions options) in C:\Source\marten\src\Marten\Storage\StorageFeatures.cs:line 93
at Marten.Storage.StorageFeatures.MappingFor(Type documentType) in C:\Source\marten\src\Marten\Storage\StorageFeatures.cs:line 175
at Marten.Storage.StorageFeatures.FindMapping(Type documentType) in C:\Source\marten\src\Marten\Storage\StorageFeatures.cs:line 194
at Marten.Storage.StorageFeatures.BuildAllMappings() in C:\Source\marten\src\Marten\Storage\StorageFeatures.cs:line 128
Changed NpgsqlTypeMapping to use ImHashMap for thread-safe usage.
Per @Hawxy at Discord conversation,
NpgsqlTypeMapping
is causing the issue when starting multiple Marten instances in parallel:Changed
NpgsqlTypeMapping
to useImHashMap
for thread-safe usage.@jeremydmiller, @mysticmind FYI.