rspec/rules/S3885/csharp/rule.adoc

38 lines
848 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
The parameter to ``++Assembly.Load++`` includes the full specification of the dll to be loaded. Use another method, and you might end up with a dll other than the one you expected.
This rule raises an issue when ``++Assembly.LoadFrom++``, ``++Assembly.LoadFile++``, or ``++Assembly.LoadWithPartialName++`` is called.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,csharp]
2021-04-28 16:49:39 +02:00
----
static void Main(string[] args)
{
Assembly.LoadFrom(...); // Noncompliant
Assembly.LoadFile(...); // Noncompliant
Assembly.LoadWithPartialName(...); // Noncompliant + deprecated
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Replace this call to "Assembly.xxx" with "Assembly.Load".
=== Highlighting
``++Assembly.xxx++``
endif::env-github,rspecator-view[]