Harry
Harry

Reputation: 23

What is an untrusted assembly in the context of unsafe code in C#

I'm struggling to understand one of the limitations of unsafe code in C#. Quoting from the Microsoft reference (https://msdn.microsoft.com/en-us/library/t2yzs44b.aspx):

In the common language runtime (CLR), unsafe code is referred to as unverifiable code. Unsafe code in C# is not necessarily dangerous; it is just code whose safety cannot be verified by the CLR. The CLR will therefore only execute unsafe code if it is in a fully trusted assembly

What is a fully trusted assembly? What causes an assembly to not be fully trusted? Will using a library that uses unsafe code limit how my own code can be deployed/run?

Upvotes: 2

Views: 444

Answers (1)

SLaks
SLaks

Reputation: 887797

This refers to a deprecated feature called Partial Trust.

Partial Trust was never very robust, and is no longer supported or recommended.

As of .Net 4, all code runs with full trust, unless a custom CLR host configures the CLR differently.

Upvotes: 1

Related Questions