Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update snaps
  • Loading branch information
thomhurst committed Apr 16, 2025
commit c0de1c31afacbe05964c767752bb2f5cd0b2ead1
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,38 @@ public static class AssemblyLoader
[global::System.Runtime.CompilerServices.ModuleInitializer]
public static void Initialize()
{
_ = typeof(global::System.SequencePosition).Assembly;
_ = typeof(global::System.Xml.XmlNamedNodeMap).Assembly;
_ = typeof(global::System.Xml.Linq.XAttribute).Assembly;
_ = typeof(global::TUnit.Core.AsyncEvent<>).Assembly;
try
{
_ = typeof(global::System.SequencePosition).Assembly;
}
catch
{
// ignored
}
try
{
_ = typeof(global::System.Xml.XmlNamedNodeMap).Assembly;
}
catch
{
// ignored
}
try
{
_ = typeof(global::System.Xml.Linq.XAttribute).Assembly;
}
catch
{
// ignored
}
try
{
_ = typeof(global::TUnit.Core.AsyncEvent<>).Assembly;
}
catch
{
// ignored
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,46 @@ public static class AssemblyLoader
[global::System.Runtime.CompilerServices.ModuleInitializer]
public static void Initialize()
{
_ = typeof(global::System.SequencePosition).Assembly;
_ = typeof(global::System.Diagnostics.ActivityChangedEventArgs).Assembly;
_ = typeof(global::System.Xml.XmlNamedNodeMap).Assembly;
_ = typeof(global::System.Xml.Linq.XAttribute).Assembly;
_ = typeof(global::TUnit.Core.AsyncEvent<>).Assembly;
try
{
_ = typeof(global::System.SequencePosition).Assembly;
}
catch
{
// ignored
}
try
{
_ = typeof(global::System.Diagnostics.ActivityChangedEventArgs).Assembly;
}
catch
{
// ignored
}
try
{
_ = typeof(global::System.Xml.XmlNamedNodeMap).Assembly;
}
catch
{
// ignored
}
try
{
_ = typeof(global::System.Xml.Linq.XAttribute).Assembly;
}
catch
{
// ignored
}
try
{
_ = typeof(global::TUnit.Core.AsyncEvent<>).Assembly;
}
catch
{
// ignored
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,22 @@ public static class AssemblyLoader
[global::System.Runtime.CompilerServices.ModuleInitializer]
public static void Initialize()
{
_ = typeof(global::System.Runtime.CompilerServices.AsyncMethodBuilderAttribute).Assembly;
_ = typeof(global::TUnit.Core.AsyncEvent<>).Assembly;
try
{
_ = typeof(global::System.Runtime.CompilerServices.AsyncMethodBuilderAttribute).Assembly;
}
catch
{
// ignored
}
try
{
_ = typeof(global::TUnit.Core.AsyncEvent<>).Assembly;
}
catch
{
// ignored
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ private void GenerateCode(SourceProductionContext context, Compilation compilati
typeName += $"<{new string(',', type.TypeParameters.Length - 1)}>";
}

sourceBuilder.WriteLine("try");
sourceBuilder.WriteLine("{");
sourceBuilder.WriteLine($"_ = typeof({typeName}).Assembly;");
sourceBuilder.WriteLine("}");
sourceBuilder.WriteLine("catch");
sourceBuilder.WriteLine("{");
sourceBuilder.WriteLine("// ignored");
sourceBuilder.WriteLine("}");
}

sourceBuilder.WriteLine("}");
Expand Down
Loading