public void VisitBegins(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0}", begin.Type);				

			m_current = new Entry();
		}
		public void VisitBegin(BeginMethods begin)
		{
			m_fields.Clear();
			m_table.Clear();
			
			foreach (FieldDefinition field in begin.Type.Fields)
			{
				if (field.IsPrivate && field.IsStatic)
				{
					string key = DoIsCollection(field.FieldType);
					if (key != null)
					{
						Log.DebugLine(this, "-----------------------------------"); 
						Log.DebugLine(this, "{0:F} has a private static collection named {1}", begin.Type, field.Name);				
				
						if (DoHasReferenceElements(field.FieldType))
						{
							Log.DebugLine(this, "and the element types are reference types");	
							m_fields.Add(field);
							m_table.Add(field, new Entry(key));
						}
					}
				}
			}
		}
Exemple #3
0
		public void VisitBegin(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0}", begin.Type);				

			m_foundEquals = false;					
		}
Exemple #4
0
		public void VisitBegin(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0}", begin.Type.FullName);

			m_type = begin.Type;
			m_types.Clear();
		}
		public void VisitBegin(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0}", begin.Type);				
			
			m_equalities.Clear();
			m_properties.Clear();
		}
		public void VisitBegin(BeginMethods begin)
		{
			m_notSerializable = !begin.Type.TypeOrBaseImplements("System.Runtime.Serialization.ISerializable", Cache);
			m_hasMethod = false;
			
			if (m_notSerializable)
			{
				Log.DebugLine(this, "-----------------------------------"); 
				Log.DebugLine(this, "{0}", begin.Type);				
			}
		}
		public void VisitBegin(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0}", begin.Type);				
			
			m_needsCheck = begin.Type.Methods.Count >= 4 && begin.Type.Fields.Count >= 4;
			m_type = begin.Type;
			m_method = null;
			m_valid.Clear();
			m_calls.Clear();
			m_table.Clear();
		}
Exemple #8
0
		public void VisitBegin(BeginMethods begin)
		{						
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "checking {0}", begin.Type);				

			m_names.Clear();

			foreach (FieldDefinition f in begin.Type.Fields)
			{
				DoAdd(f.Name);
			}
		}
Exemple #9
0
		public void VisitBegin(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0:F}", begin.Type);				

			m_fields.Clear();

			if (begin.Type.Constructors.Count > 0)	// some of the types in the 1.9 system dll's have no ctors...
			{
				foreach (FieldDefinition field in begin.Type.Fields)
					if (field.IsPrivate && !field.IsLiteral)
						if (!field.FieldType.IsValueType && !field.IsCompilerControlled)
							m_fields.Add(field.Name);
			}
		}
		public void VisitBegin(BeginMethods begin)
		{
			m_type = begin.Type;
			m_disposable = m_type.BaseImplements("System.IDisposable", Cache) && !m_type.IsCompilerGenerated();
			
			m_hasFinalizer = false;
			m_hasDispose = false;

			m_disposeMethod = null;
			m_hasBaseCall = false;
			
			if (m_disposable)
			{
				Log.DebugLine(this, "-----------------------------------"); 
				Log.DebugLine(this, "{0}", m_type);				
			}
		}
Exemple #11
0
		public void VisitBegin(BeginMethods begin)
		{
			m_disposable = false;
			
			TypeDefinition baseType = Cache.FindType(begin.Type.BaseType);
			
			if (!begin.Type.IsSealed && !begin.Type.IsNestedPrivate && !begin.Type.IsCompilerGenerated())
				if (begin.Type.TypeImplements("System.IDisposable"))
					if (baseType == null || !baseType.TypeOrBaseImplements("System.IDisposable", Cache))	// don't check types with redundent IDisposable declarations
						if (!begin.Type.IsInterface)
							m_disposable = true;
			m_hasUnaryDispose = false;
			
			if (m_disposable)
			{
				Log.DebugLine(this, "-----------------------------------"); 
				Log.DebugLine(this, "{0}", begin.Type);				
			}
		}
Exemple #12
0
		public void VisitBegin(BeginMethods begin)
		{
			m_type = begin.Type;
			m_disposable = begin.Type.TypeOrBaseImplements("System.IDisposable", Cache) && !m_type.IsCompilerGenerated();
		
			m_hasFinalizer = false;
			m_supressWasCalled = false;
			m_hasVirtualDispose = false;
			m_hasPublicDispose = false;
			m_hasNonProtectedDispose = false;
			m_hasNonVirtualDispose = false;
			m_disposeThrows = false;
			m_hasNativeFields = false;
			
			m_badDisposeNames.Clear();
			m_illegalDisposeNames.Clear();

			m_disposableFields.Clear();

			m_noThrowMethods = string.Empty;
			
			m_hasNullCall = false;
			m_ownedFields.Clear();
			
			if (m_disposable)
			{
				Log.DebugLine(this, "-----------------------------------"); 
				Log.DebugLine(this, "{0}", m_type);				
			}
			
			// We can't visit fields using the dispatcher because we're kicking 
			// the visit off with BeginMethods instead of BeginType so we have 
			// to manually visit them.
			foreach (FieldDefinition field in m_type.Fields)
				VisitField(field);
		}
Exemple #13
0
		public void VisitBegin(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0}", begin.Type);				
			
			m_needsCheck = begin.Type.Methods.Count >= 6 && begin.Type.Fields.Count >= 6;
			m_type = begin.Type;
			m_method = null;
			m_partitions.Clear();
		}
Exemple #14
0
		private void DoCheckMethods(AssemblyCache cache, string[] onlyType)
		{			
			Profile.Start("CheckMethods");
			
			foreach (KeyValuePair<TypeDefinition, List<MethodInfo>> entry in cache.TypeMethods)
			{
				if (DoNameNeedsCheck(entry.Key.FullName, onlyType))
				{
					BeginMethods begin = new BeginMethods(entry.Key);
					m_checker.Dispatcher.Dispatch(begin);
				
					foreach (MethodInfo method in entry.Value)
					{
						m_checker.Check(method);
					}
	
					EndMethods end = new EndMethods(entry.Key);
					m_checker.Dispatcher.Dispatch(end);
				}
			}

			Profile.Stop("CheckMethods");
		}
		public void VisitBegin(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0}", begin.Type);				
		}
Exemple #16
0
 internal void Dispatch(BeginMethods methods)
 {
     DoVisit(methods);
 }
		// One possible improvement is to use a real hash of the block instead of simply
		// the block length. This would significantly cut down on false matches, but it
		// also require us to revisit instructions which tends to blow. From examination
		// it appears that we compare very few blocks so a hash doesn't seem terribly
		// useful.
		public void VisitBegin(BeginMethods begin)
		{			
			Unused.Value = begin;
			
			m_table.Clear();
		}