Skip to content

Commit 552f227

Browse files
committed
Fix AssemblyResolve in .NET Core
1 parent 946873d commit 552f227

File tree

10 files changed

+33
-7
lines changed

10 files changed

+33
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Fixed
1111
- Fix `Installation` Application issue.
1212
- Fix `Timeout` issue with `testsFinishedForceToEnd`.
13-
### Updated
14-
- Update `ricaun.Revit.Installation`
13+
### Command
14+
- Update `ricaun.Revit.Installation` to `1.1.2`
1515
- Update `debugger` with debug logs.
1616
- Update `Command` with `SemanticVersion`.
17+
### Application
18+
- Fix `AssemblyResolve` in `.NET Core` updated `AppDomainExtension`.
19+
### Shared
20+
- Update `NamedPipeWrapper.Json` to `1.7.0`
21+
### TestAdapter
1722
- Update `TestAdapter` with debug logs.
1823
- Update `TestAdapter` with `PackageTags`
1924
- Update `TestAdapter` with `PackageLicenseFile`
2025

26+
2127
## [1.3.0] / 2024-03-28
2228
### Features
2329
- Readme information to wiki.

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>1.3.1-beta.1</Version>
3+
<Version>1.3.1-rc</Version>
44
</PropertyGroup>
55
</Project>

ricaun.RevitTest.Application/Extensions/AppDomainUtils.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ internal static class AppDomainUtils
1212
/// <returns></returns>
1313
public static AppDomainExtension.DelegatesDisposable AssemblyResolveDisposable()
1414
{
15+
#if DEBUG
16+
var resolveEventHandler = AppDomain.CurrentDomain.GetResolveEventHandler();
17+
Console.WriteLine($"Debug Domain >> {AppDomain.CurrentDomain.FriendlyName}");
18+
Console.WriteLine($"Debug Assembly >> {typeof(AppDomainUtils).Assembly.FullName}");
19+
Console.WriteLine($"Debug Location >> {typeof(AppDomainUtils).Assembly.Location}");
20+
Console.WriteLine($"Debug GetResolveEventHandler >> {resolveEventHandler}");
21+
if (resolveEventHandler is not null)
22+
{
23+
Console.WriteLine($"Debug GetInvocationList >> {resolveEventHandler.GetInvocationList().Length}");
24+
}
25+
#endif
1526
return AppDomain.CurrentDomain.GetAssemblyResolveDisposable().NotRemoveDelegatesAfterDispose();
1627
}
1728
}
@@ -25,12 +36,21 @@ internal static class AppDomainExtension
2536
/// <returns></returns>
2637
public static ResolveEventHandler GetResolveEventHandler(this AppDomain appDomain)
2738
{
39+
#if NETFRAMEWORK
2840
var fieldName = "_AssemblyResolve";
2941

3042
var fieldInfo = appDomain.GetType()
3143
.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
3244

3345
return fieldInfo?.GetValue(appDomain) as ResolveEventHandler;
46+
#elif NET
47+
var fieldName = "AssemblyResolve";
48+
49+
var fieldInfo = typeof(System.Runtime.Loader.AssemblyLoadContext)
50+
.GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic);
51+
52+
return fieldInfo?.GetValue(null) as ResolveEventHandler;
53+
#endif
3454
}
3555

3656
/// <summary>

ricaun.RevitTest.Application/ricaun.RevitTest.Application.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
<PackageReference Include="Newtonsoft.Json" Version="9.*" IncludeAssets="build; compile" PrivateAssets="All">
140140
<NoWarn>NU1903</NoWarn>
141141
</PackageReference>
142-
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
142+
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
143143
</ItemGroup>
144144

145145
<ItemGroup>
-187 Bytes
Binary file not shown.

ricaun.RevitTest.Console/ricaun.RevitTest.Console.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</ItemGroup>
4848

4949
<ItemGroup>
50-
<PackageReference Include="ricaun.Revit.Installation" Version="*-*" />
50+
<PackageReference Include="ricaun.Revit.Installation" Version="*" />
5151
<PackageReference Include="Microsoft.VisualStudio.Interop" Version="*" />
5252
</ItemGroup>
5353

ricaun.RevitTest.Shared/ricaun.RevitTest.Shared.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</ItemGroup>
6565

6666
<ItemGroup>
67-
<PackageReference Include="NamedPipeWrapper.Json" Version="*-*" />
67+
<PackageReference Include="NamedPipeWrapper.Json" Version="*" />
6868
<PackageReference Include="ricaun.NUnit" Version="*" />
6969
</ItemGroup>
7070

-292 Bytes
Binary file not shown.
-296 Bytes
Binary file not shown.

ricaun.RevitTest.Tests/ricaun.RevitTest.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
<ItemGroup>
5858
<PackageReference Include="ricaun.Revit.Async" Version="*" />
59-
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
59+
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
6060
</ItemGroup>
6161

6262
</Project>

0 commit comments

Comments
 (0)