Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="FSharp.Core" Version="9.0.100" />
<PackageVersion Include="FSharp.SystemTextJson" Version="1.3.13" />
<PackageVersion Include="JasperFx" Version="1.27.0" />
<PackageVersion Include="JasperFx.Events" Version="1.30.0" />
<PackageVersion Include="JasperFx" Version="1.28.1" />
<PackageVersion Include="JasperFx.Events" Version="1.31.0" />
<PackageVersion Include="JasperFx.Events.SourceGenerator" Version="1.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="JasperFx.RuntimeCompiler" Version="4.4.0" />
<PackageVersion Include="JasperFx.RuntimeCompiler" Version="4.5.0" />
<PackageVersion Include="Jil" Version="3.0.0-alpha2" />
<PackageVersion Include="Lamar" Version="7.1.1" />
<PackageVersion Include="Lamar.Microsoft.DependencyInjection" Version="15.0.0" />
Expand Down
9 changes: 8 additions & 1 deletion src/Marten/DocumentStore.CompiledQueryCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ internal ICompiledQuerySource GetCompiledQuerySourceFor<TDoc, TOut>(ICompiledQue
var rules = _store.Options.CreateGenerationRules();
rules.ReferenceTypes(typeof(TDoc), typeof(TOut), query.GetType());

file.InitializeSynchronously(rules, _store, null);
// Disambiguated against JasperFx 1.28's new
// JasperFx.CodeGeneration.CodeFileExtensions.InitializeSynchronously,
// which requires IAssemblyGenerator registered in DI. Marten passes a
// null IServiceProvider here, so we explicitly call the obsolete
// JasperFx.RuntimeCompiler overload that still falls back to a fresh
// AssemblyGenerator. Tracked for proper migration in Marten 9.0
// (see issue #4309 — AOT-friendly mode).
JasperFx.RuntimeCompiler.CodeFileExtensions.InitializeSynchronously(file, rules, _store, null);

source = file.Build(rules);
_querySources = _querySources.AddOrUpdate(query.GetType(), source);
Expand Down
11 changes: 9 additions & 2 deletions src/Marten/Internal/ProviderGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ internal DocumentProvider<T> CreateDocumentProvider<T>() where T : notnull
if (documentType == typeof(IEvent))
{
var rules = _options.CreateGenerationRules();
_options.EventGraph.InitializeSynchronously(rules, _options.EventGraph, null);
// Disambiguated against JasperFx 1.28's new
// JasperFx.CodeGeneration.CodeFileExtensions.InitializeSynchronously
// which requires IAssemblyGenerator in DI. We pass null services here
// so we deliberately route through the obsolete RuntimeCompiler
// overload that constructs a fresh AssemblyGenerator. Proper
// migration tracked under Marten 9.0 issue #4309.
JasperFx.RuntimeCompiler.CodeFileExtensions.InitializeSynchronously(_options.EventGraph, rules, _options.EventGraph, null);

_storage = _storage.AddOrUpdate(documentType, _options.EventGraph.Provider);

Expand All @@ -78,7 +84,8 @@ internal DocumentProvider<T> CreateDocumentProvider<T>() where T : notnull

var rules = _options.CreateGenerationRules();
rules.ReferenceTypes(m.DocumentType);
builder.InitializeSynchronously(rules, _options, null);
// See note above for the disambiguation rationale.
JasperFx.RuntimeCompiler.CodeFileExtensions.InitializeSynchronously(builder, rules, _options, null);
var slot = builder.BuildProvider<T>();

_storage = _storage.AddOrUpdate(documentType, slot);
Expand Down
9 changes: 8 additions & 1 deletion src/Marten/Internal/SecondaryStoreConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ public T Build(IServiceProvider provider)
// ParentDirectory(). Align the paths to avoid writing duplicate files
// with the same namespace and class name to different directories (#4185)
rules.GeneratedCodeOutputPath = rules.GeneratedCodeOutputPath.ParentDirectory();
this.InitializeSynchronously(rules, Parent, provider);
// Disambiguated against JasperFx 1.28's new
// JasperFx.CodeGeneration.CodeFileExtensions.InitializeSynchronously.
// The 'provider' here may be non-null (it's the host IServiceProvider)
// but it isn't required to have IAssemblyGenerator registered, so we
// route through the obsolete RuntimeCompiler overload that uses a
// fresh AssemblyGenerator. Proper migration tracked under Marten 9.0
// issue #4309.
JasperFx.RuntimeCompiler.CodeFileExtensions.InitializeSynchronously(this, rules, Parent, provider);

var store = (T)Activator.CreateInstance(_storeType!, options)!;
store.As<DocumentStore>().Subject = new Uri("marten://" + typeof(T).Name.ToLowerInvariant());
Expand Down
Loading