|
5 | 5 | namespace Microsoft.Data.SqlClient.TestCommon; |
6 | 6 |
|
7 | 7 | /// <summary> |
8 | | -/// Provides a shared xUnit conditional check for tests that depend on SQL Server UDT types. |
| 8 | +/// Provides a shared xUnit conditional check for tests that depend on the SqlServer assembly. |
9 | 9 | /// </summary> |
10 | | -/// <remarks> |
11 | | -/// Why this exists: in PR and local project-reference builds, the <c>Microsoft.SqlServer.Server</c> |
12 | | -/// assembly can be produced unsigned on .NET Framework when no signing key is available. Some UDT |
13 | | -/// tests use <c>Microsoft.SqlServer.Types</c> (a publicly published NuGet package, not owned by |
14 | | -/// us), which requires a strongly named <c>Microsoft.SqlServer.Server</c> assembly and fail with |
15 | | -/// <c>FileLoadException</c> ( <c>0x80131044</c>) when that requirement is not met. |
16 | | -/// |
17 | | -/// This can also happen in package-based test runs when the consumed package was produced from an |
18 | | -/// unsigned assembly (for example, package-mode restore from a local feed containing CI/dev |
19 | | -/// artifacts), not only when using direct project references. |
20 | | -/// |
21 | | -/// What this checks: on .NET Framework, it loads the UDT attribute type from |
22 | | -/// <c>Microsoft.SqlServer.Server</c> and verifies that the assembly has a non-empty public key |
23 | | -/// token (is strongly named). On .NET, this always returns <see langword="true"/> because runtime |
24 | | -/// strong-name validation is not enforced the same way. |
25 | | -/// |
26 | | -/// When to use it: add this condition to tests that execute SQL Server UDT paths and are known to |
27 | | -/// fail in unsigned net462 runs, regardless of whether the assembly comes from project references |
28 | | -/// or locally produced packages. |
29 | | -/// </remarks> |
30 | 10 | public static class SqlServerStrongNameTestCondition |
31 | 11 | { |
32 | 12 | /// <summary> |
33 | | - /// Gets whether SQL Server UDT tests are safe to run in the current runtime/signing context. |
| 13 | + /// Returns true when an unsigned SqlServer assembly should be usable in conjunction with other |
| 14 | + /// assemblies that explicitly depend on a strongly-named SqlServer assembly. |
34 | 15 | /// </summary> |
| 16 | + /// <remarks> |
| 17 | + /// Why this exists: in local builds and PR pipeline runs, the <c>Microsoft.SqlServer.Server</c> |
| 18 | + /// assembly is likely to be produced unsigned. Some UDT tests reference |
| 19 | + /// <c>Microsoft.SqlServer.Types</c> (a publicly published NuGet package, not owned by us), |
| 20 | + /// which requires a strongly named <c>Microsoft.SqlServer.Server</c> assembly. The .NET |
| 21 | + /// runtime doesn't enforce this relationship, and the tests run without incident regardless of |
| 22 | + /// the signed-ness of the SqlServer assembly. However, .NET Framework _does_ enforce that the |
| 23 | + /// SqlServer assembly us signed, and the tests fail to compile and/or run. |
| 24 | + /// |
| 25 | + /// This situation can occur in both Project and Package based test runs, the latter when the |
| 26 | + /// consumed SqlServer package was produced from an unsigned assembly. |
| 27 | + /// |
| 28 | + /// What this checks: on .NET Framework, it loads the UDT attribute type from |
| 29 | + /// <c>Microsoft.SqlServer.Server</c> and verifies that the assembly has a non-empty public key |
| 30 | + /// token (is strongly named). On .NET, this always returns <see langword="true"/> because |
| 31 | + /// runtime strong-name validation is not enforced the same way. |
| 32 | + /// |
| 33 | + /// When to use it: add this condition to tests that execute SQL Server UDT paths and are known |
| 34 | + /// to fail in unsigned .NET Framework runs, regardless of whether the assembly comes from |
| 35 | + /// project references or locally produced packages. |
| 36 | + /// </remarks> |
35 | 37 | public static bool IsUnsignedSqlServerAssemblyUsable |
36 | 38 | { |
37 | 39 | get |
|
0 commit comments