2 // System.Reflection/Assembly.cs
5 // Paolo Molaro (lupus@ximian.com)
7 // (C) 2001 Ximian, Inc. http://www.ximian.com
8 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Security;
31 using System.Security.Policy;
32 using System.Security.Permissions;
33 using System.Runtime.Serialization;
34 using System.Reflection;
35 using System.Reflection.Emit;
37 using System.Globalization;
38 using System.Runtime.CompilerServices;
39 using System.Runtime.InteropServices;
40 using System.Collections;
41 using System.Collections.Generic;
42 using System.Configuration.Assemblies;
46 namespace System.Reflection {
48 #pragma warning disable 659 // overrides Equals but not GetHashCode
51 [ComDefaultInterfaceAttribute (typeof (_Assembly))]
53 [ClassInterface(ClassInterfaceType.None)]
55 public class Assembly : ICustomAttributeProvider, _Assembly {
57 public class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
60 internal class ResolveEventHolder {
61 public event ModuleResolveEventHandler ModuleResolve;
64 // Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
65 #pragma warning disable 649
66 private IntPtr _mono_assembly;
67 #pragma warning restore 649
69 private ResolveEventHolder resolve_event_holder;
70 private Evidence _evidence;
71 internal PermissionSet _minimum; // for SecurityAction.RequestMinimum
72 internal PermissionSet _optional; // for SecurityAction.RequestOptional
73 internal PermissionSet _refuse; // for SecurityAction.RequestRefuse
74 private PermissionSet _granted; // for the resolved assembly granted permissions
75 private PermissionSet _denied; // for the resolved assembly denied permissions
76 private bool fromByteArray;
77 private string assemblyName;
81 resolve_event_holder = new ResolveEventHolder ();
85 // We can't store the event directly in this class, since the
86 // compiler would silently insert the fields before _mono_assembly
88 public event ModuleResolveEventHandler ModuleResolve {
89 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
91 resolve_event_holder.ModuleResolve += value;
93 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
95 resolve_event_holder.ModuleResolve -= value;
99 [MethodImplAttribute (MethodImplOptions.InternalCall)]
100 private extern string get_code_base (bool escaped);
102 [MethodImplAttribute (MethodImplOptions.InternalCall)]
103 private extern string get_fullname ();
105 [MethodImplAttribute (MethodImplOptions.InternalCall)]
106 private extern string get_location ();
108 [MethodImplAttribute (MethodImplOptions.InternalCall)]
109 private extern string InternalImageRuntimeVersion ();
111 // SECURITY: this should be the only caller to icall get_code_base
112 private string GetCodeBase (bool escaped)
114 string cb = get_code_base (escaped);
116 if (SecurityManager.SecurityEnabled) {
117 // we cannot divulge local file informations
118 if (String.Compare ("FILE://", 0, cb, 0, 7, true, CultureInfo.InvariantCulture) == 0) {
119 string file = cb.Substring (7);
120 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, file).Demand ();
127 public virtual string CodeBase {
128 get { return GetCodeBase (false); }
131 public virtual string EscapedCodeBase {
132 get { return GetCodeBase (true); }
135 public virtual string FullName {
138 // FIXME: This is wrong, but it gets us going
139 // in the compiler for now
145 public virtual extern MethodInfo EntryPoint {
146 [MethodImplAttribute (MethodImplOptions.InternalCall)]
149 #if !NET_2_1 || MONOTOUCH
150 public virtual Evidence Evidence {
151 [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
152 get { return UnprotectedGetEvidence (); }
155 // note: the security runtime requires evidences but may be unable to do so...
156 internal Evidence UnprotectedGetEvidence ()
158 // if the host (runtime) hasn't provided it's own evidence...
159 if (_evidence == null) {
160 // ... we will provide our own
162 _evidence = Evidence.GetDefaultHostEvidence (this);
168 [MethodImplAttribute (MethodImplOptions.InternalCall)]
169 private extern bool get_global_assembly_cache ();
171 public bool GlobalAssemblyCache {
173 return get_global_assembly_cache ();
177 internal bool FromByteArray {
178 set { fromByteArray = value; }
181 public virtual String Location {
186 string loc = get_location ();
188 if ((loc != String.Empty) && SecurityManager.SecurityEnabled) {
189 // we cannot divulge local file informations
190 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, loc).Demand ();
198 public virtual string ImageRuntimeVersion {
200 return InternalImageRuntimeVersion ();
204 [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
205 public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
208 throw new ArgumentNullException ("info");
210 UnitySerializationHolder.GetAssemblyData (this, info, context);
213 public virtual bool IsDefined (Type attributeType, bool inherit)
215 return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
218 public virtual object [] GetCustomAttributes (bool inherit)
220 return MonoCustomAttrs.GetCustomAttributes (this, inherit);
223 public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
225 return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
228 [MethodImplAttribute (MethodImplOptions.InternalCall)]
229 private extern object GetFilesInternal (String name, bool getResourceModules);
231 public virtual FileStream[] GetFiles ()
233 return GetFiles (false);
236 public virtual FileStream [] GetFiles (bool getResourceModules)
238 string[] names = (string[]) GetFilesInternal (null, getResourceModules);
240 return new FileStream [0];
242 string location = Location;
245 if (location != String.Empty) {
246 res = new FileStream [names.Length + 1];
247 res [0] = new FileStream (location, FileMode.Open, FileAccess.Read);
248 for (int i = 0; i < names.Length; ++i)
249 res [i + 1] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
251 res = new FileStream [names.Length];
252 for (int i = 0; i < names.Length; ++i)
253 res [i] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
258 public virtual FileStream GetFile (String name)
261 throw new ArgumentNullException (null, "Name cannot be null.");
262 if (name.Length == 0)
263 throw new ArgumentException ("Empty name is not valid");
265 string filename = (string)GetFilesInternal (name, true);
266 if (filename != null)
267 return new FileStream (filename, FileMode.Open, FileAccess.Read);
272 [MethodImplAttribute (MethodImplOptions.InternalCall)]
273 internal extern IntPtr GetManifestResourceInternal (String name, out int size, out Module module);
275 public virtual Stream GetManifestResourceStream (String name)
278 throw new ArgumentNullException ("name");
279 if (name.Length == 0)
280 throw new ArgumentException ("String cannot have zero length.",
283 ManifestResourceInfo info = GetManifestResourceInfo (name);
287 if (info.ReferencedAssembly != null)
288 return info.ReferencedAssembly.GetManifestResourceStream (name);
289 if ((info.FileName != null) && (info.ResourceLocation == 0)) {
291 throw new FileNotFoundException (info.FileName);
293 string location = Path.GetDirectoryName (Location);
294 string filename = Path.Combine (location, info.FileName);
295 #if NET_2_1 && !MONOTOUCH
296 // we don't control the content of 'info.FileName' so we want to make sure we keep to ourselves
297 filename = Path.GetFullPath (filename);
298 if (!filename.StartsWith (location))
299 throw new SecurityException ("non-rooted access to manifest resource");
301 return new FileStream (filename, FileMode.Open, FileAccess.Read);
306 IntPtr data = GetManifestResourceInternal (name, out size, out module);
307 if (data == (IntPtr) 0)
310 UnmanagedMemoryStream stream;
312 stream = new UnmanagedMemoryStream ((byte*) data, size);
315 * The returned pointer points inside metadata, so
316 * we have to increase the refcount of the module, and decrease
317 * it when the stream is finalized.
319 stream.Closed += new EventHandler (new ResourceCloseHandler (module).OnClose);
324 public virtual Stream GetManifestResourceStream (Type type, String name)
331 throw new ArgumentNullException ("type");
335 if (ns == null || ns.Length == 0)
336 return GetManifestResourceStream (name);
338 return GetManifestResourceStream (ns + "." + name);
341 [MethodImplAttribute (MethodImplOptions.InternalCall)]
342 internal virtual extern Type[] GetTypes (bool exportedOnly);
344 public virtual Type[] GetTypes ()
346 return GetTypes (false);
349 public virtual Type[] GetExportedTypes ()
351 return GetTypes (true);
354 public virtual Type GetType (String name, Boolean throwOnError)
356 return GetType (name, throwOnError, false);
359 public virtual Type GetType (String name) {
360 return GetType (name, false, false);
363 [MethodImplAttribute (MethodImplOptions.InternalCall)]
364 internal extern Type InternalGetType (Module module, String name, Boolean throwOnError, Boolean ignoreCase);
366 public Type GetType (string name, bool throwOnError, bool ignoreCase)
369 throw new ArgumentNullException (name);
370 if (name.Length == 0)
371 throw new ArgumentException ("name", "Name cannot be empty");
373 return InternalGetType (null, name, throwOnError, ignoreCase);
376 [MethodImplAttribute (MethodImplOptions.InternalCall)]
377 internal extern static void InternalGetAssemblyName (string assemblyFile, AssemblyName aname);
379 [MethodImplAttribute (MethodImplOptions.InternalCall)]
380 static extern void FillName (Assembly ass, AssemblyName aname);
382 [MonoTODO ("copiedName == true is not supported")]
383 public virtual AssemblyName GetName (Boolean copiedName)
385 // CodeBase, which is restricted, will be copied into the AssemblyName object so...
386 if (SecurityManager.SecurityEnabled) {
387 GetCodeBase (true); // this will ensure the Demand is made
389 return UnprotectedGetName ();
392 public virtual AssemblyName GetName ()
394 return GetName (false);
397 // the security runtime requires access to the assemblyname (e.g. to get the strongname)
398 internal virtual AssemblyName UnprotectedGetName ()
400 AssemblyName aname = new AssemblyName ();
401 FillName (this, aname);
405 public override string ToString ()
407 // note: ToString work without requiring CodeBase (so no checks are needed)
409 if (assemblyName != null)
412 assemblyName = get_fullname ();
416 public static String CreateQualifiedName (String assemblyName, String typeName)
418 return typeName + ", " + assemblyName;
421 public static Assembly GetAssembly (Type type)
424 return type.Assembly;
425 throw new ArgumentNullException ("type");
429 [MethodImplAttribute (MethodImplOptions.InternalCall)]
430 public static extern Assembly GetEntryAssembly();
432 public Assembly GetSatelliteAssembly (CultureInfo culture)
434 return GetSatelliteAssembly (culture, null, true);
437 public Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
439 return GetSatelliteAssembly (culture, version, true);
442 internal Assembly GetSatelliteAssemblyNoThrow (CultureInfo culture, Version version)
444 return GetSatelliteAssembly (culture, version, false);
447 private Assembly GetSatelliteAssembly (CultureInfo culture, Version version, bool throwOnError)
450 throw new ArgumentException ("culture");
452 AssemblyName aname = GetName (true);
454 aname.Version = version;
456 aname.CultureInfo = culture;
457 aname.Name = aname.Name + ".resources";
461 assembly = AppDomain.CurrentDomain.LoadSatellite (aname, false);
462 if (assembly != null)
464 } catch (FileNotFoundException) {
469 // Try the assembly directory
470 string location = Path.GetDirectoryName (Location);
471 string fullName = Path.Combine (location, Path.Combine (culture.Name, aname.Name + ".dll"));
472 #if NET_2_1 && !MONOTOUCH
473 // it's unlikely that culture.Name or aname.Name could contain stuff like ".." but...
474 fullName = Path.GetFullPath (fullName);
475 if (!fullName.StartsWith (location)) {
477 throw new SecurityException ("non-rooted access to satellite assembly");
481 if (!throwOnError && !File.Exists (fullName))
484 return LoadFrom (fullName);
487 [MethodImplAttribute (MethodImplOptions.InternalCall)]
488 private extern static Assembly LoadFrom (String assemblyFile, bool refonly);
490 public static Assembly LoadFrom (String assemblyFile)
492 return LoadFrom (assemblyFile, false);
495 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence)
497 Assembly a = LoadFrom (assemblyFile, false);
499 if ((a != null) && (securityEvidence != null)) {
500 // merge evidence (i.e. replace defaults with provided evidences)
501 a.Evidence.Merge (securityEvidence);
507 [MonoTODO("This overload is not currently implemented")]
508 // FIXME: What are we missing?
509 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
511 if (assemblyFile == null)
512 throw new ArgumentNullException ("assemblyFile");
513 if (assemblyFile == String.Empty)
514 throw new ArgumentException ("Name can't be the empty string", "assemblyFile");
515 throw new NotImplementedException ();
518 public static Assembly LoadFile (String path, Evidence securityEvidence)
521 throw new ArgumentNullException ("path");
522 if (path == String.Empty)
523 throw new ArgumentException ("Path can't be empty", "path");
524 // FIXME: Make this do the right thing
525 return LoadFrom (path, securityEvidence);
528 public static Assembly LoadFile (String path)
530 return LoadFile (path, null);
533 public static Assembly Load (String assemblyString)
535 return AppDomain.CurrentDomain.Load (assemblyString);
538 public static Assembly Load (String assemblyString, Evidence assemblySecurity)
540 return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
543 public static Assembly Load (AssemblyName assemblyRef)
545 return AppDomain.CurrentDomain.Load (assemblyRef);
548 public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
550 return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
553 public static Assembly Load (Byte[] rawAssembly)
555 return AppDomain.CurrentDomain.Load (rawAssembly);
558 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
560 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
563 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
564 Evidence securityEvidence)
566 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
569 public static Assembly ReflectionOnlyLoad (byte[] rawAssembly)
571 return AppDomain.CurrentDomain.Load (rawAssembly, null, null, true);
574 public static Assembly ReflectionOnlyLoad (string assemblyString)
576 return AppDomain.CurrentDomain.Load (assemblyString, null, true);
579 public static Assembly ReflectionOnlyLoadFrom (string assemblyFile)
581 if (assemblyFile == null)
582 throw new ArgumentNullException ("assemblyFile");
584 return LoadFrom (assemblyFile, true);
587 public static Assembly LoadWithPartialName (string partialName)
589 return LoadWithPartialName (partialName, null);
592 [MonoTODO ("Not implemented")]
593 public Module LoadModule (string moduleName, byte [] rawModule)
595 throw new NotImplementedException ();
598 [MonoTODO ("Not implemented")]
599 public Module LoadModule (string moduleName, byte [] rawModule, byte [] rawSymbolStore)
601 throw new NotImplementedException ();
604 [MethodImplAttribute (MethodImplOptions.InternalCall)]
605 private static extern Assembly load_with_partial_name (string name, Evidence e);
607 public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
609 return LoadWithPartialName (partialName, securityEvidence, true);
613 * LAMESPEC: It is possible for this method to throw exceptions IF the name supplied
614 * is a valid gac name and contains filesystem entry charachters at the end of the name
615 * ie System/// will throw an exception. However ////System will not as that is canocolized
619 // FIXME: LoadWithPartialName must look cache (no CAS) or read from disk (CAS)
620 internal static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence, bool oldBehavior)
623 throw new NotImplementedException ();
625 if (partialName == null)
626 throw new NullReferenceException ();
628 return load_with_partial_name (partialName, securityEvidence);
631 public Object CreateInstance (String typeName)
633 return CreateInstance (typeName, false);
636 public Object CreateInstance (String typeName, Boolean ignoreCase)
638 Type t = GetType (typeName, false, ignoreCase);
643 return Activator.CreateInstance (t);
644 } catch (InvalidOperationException) {
645 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
649 public Object CreateInstance (String typeName, Boolean ignoreCase,
650 BindingFlags bindingAttr, Binder binder,
651 Object[] args, CultureInfo culture,
652 Object[] activationAttributes)
654 Type t = GetType (typeName, false, ignoreCase);
659 return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
660 } catch (InvalidOperationException) {
661 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
665 public Module[] GetLoadedModules ()
667 return GetLoadedModules (false);
670 // FIXME: Currently, the two sets of modules are equal
671 public Module[] GetLoadedModules (bool getResourceModules)
673 return GetModules (getResourceModules);
676 public Module[] GetModules ()
678 return GetModules (false);
681 public Module GetModule (String name)
684 throw new ArgumentNullException ("name");
685 if (name.Length == 0)
686 throw new ArgumentException ("Name can't be empty");
688 Module[] modules = GetModules (true);
689 foreach (Module module in modules) {
690 if (module.ScopeName == name)
697 [MethodImplAttribute (MethodImplOptions.InternalCall)]
698 internal virtual extern Module[] GetModulesInternal ();
700 public Module[] GetModules (bool getResourceModules) {
701 Module[] modules = GetModulesInternal ();
703 if (!getResourceModules) {
704 ArrayList result = new ArrayList (modules.Length);
705 foreach (Module m in modules)
706 if (!m.IsResource ())
708 return (Module[])result.ToArray (typeof (Module));
714 [MethodImplAttribute (MethodImplOptions.InternalCall)]
715 internal extern string[] GetNamespaces ();
717 [MethodImplAttribute (MethodImplOptions.InternalCall)]
718 public extern virtual String[] GetManifestResourceNames ();
720 [MethodImplAttribute (MethodImplOptions.InternalCall)]
721 public extern static Assembly GetExecutingAssembly ();
723 [MethodImplAttribute (MethodImplOptions.InternalCall)]
724 public extern static Assembly GetCallingAssembly ();
726 [MethodImplAttribute (MethodImplOptions.InternalCall)]
727 public extern AssemblyName[] GetReferencedAssemblies ();
729 [MethodImplAttribute (MethodImplOptions.InternalCall)]
730 private extern bool GetManifestResourceInfoInternal (String name, ManifestResourceInfo info);
732 public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
734 if (resourceName == null)
735 throw new ArgumentNullException ("resourceName");
736 if (resourceName.Length == 0)
737 throw new ArgumentException ("String cannot have zero length.");
738 ManifestResourceInfo result = new ManifestResourceInfo ();
739 bool found = GetManifestResourceInfoInternal (resourceName, result);
746 private class ResourceCloseHandler {
747 #pragma warning disable 169, 414
749 #pragma warning restore 169, 414
751 public ResourceCloseHandler (Module module) {
752 this.module = module;
755 public void OnClose (object sender, EventArgs e) {
756 // The module dtor will take care of things
762 // The following functions are only for the Mono Debugger.
765 [MethodImplAttribute (MethodImplOptions.InternalCall)]
766 internal static extern int MonoDebugger_GetMethodToken (MethodBase method);
768 [MonoTODO ("Currently it always returns zero")]
770 public long HostContext {
775 public Module ManifestModule {
777 return GetManifestModule ();
781 internal virtual Module GetManifestModule () {
782 return GetManifestModuleInternal ();
785 [MethodImplAttribute (MethodImplOptions.InternalCall)]
786 internal extern Module GetManifestModuleInternal ();
789 public virtual extern bool ReflectionOnly {
790 [MethodImplAttribute (MethodImplOptions.InternalCall)]
794 public override bool Equals (object o)
796 if (((object) this) == o)
802 Assembly other = (Assembly) o;
803 return other._mono_assembly == _mono_assembly;
807 public virtual IList<CustomAttributeData> GetCustomAttributesData () {
808 return CustomAttributeData.GetCustomAttributes (this);
812 #if !NET_2_1 || MONOTOUCH
813 // Code Access Security
815 internal void Resolve ()
818 // FIXME: As we (currently) delay the resolution until the first CAS
819 // Demand it's too late to evaluate the Minimum permission set as a
820 // condition to load the assembly into the AppDomain
821 LoadAssemblyPermissions ();
822 Evidence e = new Evidence (UnprotectedGetEvidence ()); // we need a copy to add PRE
823 e.AddHost (new PermissionRequestEvidence (_minimum, _optional, _refuse));
824 _granted = SecurityManager.ResolvePolicy (e,
825 _minimum, _optional, _refuse, out _denied);
829 internal PermissionSet GrantedPermissionSet {
831 if (_granted == null) {
832 if (SecurityManager.ResolvingPolicyLevel != null) {
833 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
834 return DefaultPolicies.FullTrust;
836 return null; // we can't resolve during resolution
844 internal PermissionSet DeniedPermissionSet {
846 // yes we look for granted, as denied may be null
847 if (_granted == null) {
848 if (SecurityManager.ResolvingPolicyLevel != null) {
849 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
852 return DefaultPolicies.FullTrust; // deny unrestricted
860 [MethodImplAttribute (MethodImplOptions.InternalCall)]
861 extern internal static bool LoadPermissions (Assembly a,
862 ref IntPtr minimum, ref int minLength,
863 ref IntPtr optional, ref int optLength,
864 ref IntPtr refused, ref int refLength);
866 // Support for SecurityAction.RequestMinimum, RequestOptional and RequestRefuse
867 private void LoadAssemblyPermissions ()
869 IntPtr minimum = IntPtr.Zero, optional = IntPtr.Zero, refused = IntPtr.Zero;
870 int minLength = 0, optLength = 0, refLength = 0;
871 if (LoadPermissions (this, ref minimum, ref minLength, ref optional,
872 ref optLength, ref refused, ref refLength)) {
874 // Note: no need to cache these permission sets as they will only be created once
875 // at assembly resolution time.
877 byte[] data = new byte [minLength];
878 Marshal.Copy (minimum, data, 0, minLength);
879 _minimum = SecurityManager.Decode (data);
882 byte[] data = new byte [optLength];
883 Marshal.Copy (optional, data, 0, optLength);
884 _optional = SecurityManager.Decode (data);
887 byte[] data = new byte [refLength];
888 Marshal.Copy (refused, data, 0, refLength);
889 _refuse = SecurityManager.Decode (data);
897 #pragma warning restore 659