-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Match
ReflectionTypeLoadException
handling from LibraryWriter
int…
…o `ComAliasNameResolver` (#205) * Add handling for ReflectionTypeLoadException to ComAliasNameWriter * Add sample library to reproduce export despite missing references
- Loading branch information
Showing
12 changed files
with
206 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace dSPACE.Runtime.InteropServices.DemoAssembly5; | ||
|
||
public class ExplodeyBaseClass : UserControl | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace dSPACE.Runtime.InteropServices.DemoAssembly5; | ||
|
||
public class ExplodeyMember | ||
{ | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Example")] | ||
public UserControl Control => null!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace dSPACE.Runtime.InteropServices.DemoAssembly5; | ||
|
||
public class ExplodeyParameter | ||
{ | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "example")] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "example")] | ||
public void Example(UserControl thing) | ||
{ | ||
// nop | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
namespace dSPACE.Runtime.InteropServices.DemoAssembly5; | ||
|
||
[ComVisible(true), Guid("E27C3BDB-ACEF-44F9-8568-481D44681C04"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | ||
public interface IExportableType | ||
{ | ||
void DoIt(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: ComVisible(false)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net6.0-windows;net48</TargetFrameworks> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<LangVersion>10.0</LangVersion> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>dSPACE.Runtime.InteropServices.DemoAssembly5</RootNamespace> | ||
<AssemblyName>dSPACE.Runtime.InteropServices.DemoAssembly5</AssemblyName> | ||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> | ||
<AnalysisMode>Recommended</AnalysisMode> | ||
<EnableNETAnalyzers>true</EnableNETAnalyzers> | ||
<Platforms>AnyCPU;x86</Platforms> | ||
<EnableComHosting>true</EnableComHosting> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\dscom\dscom.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2022 dSPACE GmbH, Mark Lechtermann, Matthias Nissen and Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.ComponentModel; | ||
using System.Reflection; | ||
|
||
namespace dSPACE.Runtime.InteropServices; | ||
|
||
/// <summary> | ||
/// Extension methods for <see cref="MethodBase"/>. | ||
/// </summary> | ||
[Browsable(false)] | ||
internal static class MethodBaseExtensions | ||
{ | ||
/// <summary> | ||
/// Return the parameters defined in a method, or an empty array if the | ||
/// parameter types are unloadable | ||
/// </summary> | ||
/// <param name="method">The method to enumerate</param> | ||
/// <returns>The loadable parameters</returns> | ||
internal static IEnumerable<ParameterInfo> GetLoadableParameters(this MethodInfo method) | ||
{ | ||
try | ||
{ | ||
return method.GetParameters(); | ||
} | ||
catch | ||
{ | ||
return Array.Empty<ParameterInfo>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright 2022 dSPACE GmbH, Mark Lechtermann, Matthias Nissen and Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.ComponentModel; | ||
using System.Reflection; | ||
|
||
namespace dSPACE.Runtime.InteropServices; | ||
|
||
/// <summary> | ||
/// Extension methods for <see cref="Type"/>. | ||
/// </summary> | ||
[Browsable(false)] | ||
internal static class TypeExtensions | ||
{ | ||
/// <summary> | ||
/// Return the members defined in a type, or an empty array if the | ||
/// members cannot be enumerated. | ||
/// </summary> | ||
/// <param name="type">The type to enumerate</param> | ||
/// <returns>The members which were able to be enumerated</returns> | ||
internal static IEnumerable<MemberInfo> GetLoadableMembers(this Type type) | ||
{ | ||
try | ||
{ | ||
return type.GetMembers(); | ||
} | ||
catch | ||
{ | ||
return Array.Empty<MemberInfo>(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Return the methods defined in a type, or an empty array if the | ||
/// methods cannot be enumerated. | ||
/// </summary> | ||
/// <param name="type">The type to enumerate</param> | ||
/// <returns>The Methods which were able to be enumerated</returns> | ||
internal static IEnumerable<MethodInfo> GetLoadableMethods(this Type type) | ||
{ | ||
try | ||
{ | ||
return type.GetMethods(); | ||
} | ||
catch | ||
{ | ||
return Array.Empty<MethodInfo>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters