BUG REPORT

2 posts, 0 answers
  1. Chris
    Chris avatar
    1 posts
    Member since:
    Jan 2008

    Posted 23 Jun 2011 Link to this post

    Hi there

    The first assembly I considered was CuttingEdge.Conditions.dll (http://conditions.codeplex.com/), and the first class I decompiled to C# was CuttingEdge.Conditions.CollectionHelpers. Here are the issues I found.

    1. default was used as a variable name; this is a reserved word in C#.
    2. In Fig. 1, the variable t is not declared anywhere - I think this may be due to the apparent lack of support for the foreach construct - consider the code decompiled from the same assembly using JetBrains' dotPeek in Fig. 2.
    3. In Fig. 3, the variable obj is not declared anywhere.
    4. In Fig. 4, the variable sequenceContainsNull is assigned an integer value; its type is boolean. Also in this example, a call is made to the Item method on an object of type Dictionary<TKey, TValue>. This method does not exist - the indexer should be used
    Hope this helps, and thanks for the great tool.
    
    Cheers, Chris
    
    
    Fig. 1
    internal static bool Contains<T>(IEnumerable<T> sequence, T value)
    {
    	IEqualityComparer<T> default = EqualityComparer<T>.Default;
     IEnumerator<T> enumerator = sequence.GetEnumerator();
    	using (enumerator)
    	{
    		while (enumerator.MoveNext())
    		{
    			if (default.Equals(t, value))
    			{
    				return true;
    			}
    		}
    	}
     return false;
    
    }
    
    Fig. 2
    
    internal static bool Contains<T>(IEnumerable<T> sequence, T value)
    {
        IEqualityComparer<T> equalityComparer = (IEqualityComparer<T>)EqualityComparer<T>.Default;
        foreach (T x in sequence)
        {
            if (equalityComparer.Equals(x, value))
                return true;
        }
        return false;
    }
    Fig. 3
    internal static bool Contains(IEnumerable sequence, object value)
    {
    	Comparer<object> default2 = Comparer<object>.Default;
    	IEnumerator enumerator = sequence.GetEnumerator();
    	try
    	{
    		while (enumerator.MoveNext())
    		{
    			if (default2.Compare(obj, value) == 0)
    			{
    				return true;
    			}
    		}
    	}
    	finally
    	{
    		IDisposable disposable = enumerator as IDisposable;
    		if (disposable != null)
    		{
    			disposable.Dispose();
    		}
    	}
    	return false;
    }
    
    Fig. 4
    
    private static Dictionary<T, byte> ConvertToSet<T>(IEnumerable<T> sequence, out bool sequenceContainsNull)
    {
        sequenceContainsNull = 0;
        int num = CollectionHelpers.DetermineInitialCapacity<T>(sequence);
        Dictionary<T, byte> ts = new Dictionary<T, byte>(num);
        foreach (T t in sequence)
        {
            if (t != null)
            {
                ts.Item = t;
            }
            else
            {
                sequenceContainsNull = 1;
            }
        }
        return ts;
    }
     
    private static Dictionary<objectbyte> ConvertToSet(IEnumerable sequence, out bool sequenceContainsNull)
    {
        sequenceContainsNull = 0;
        int num = CollectionHelpers.DetermineInitialCapacity(sequence);
        Dictionary<objectbyte> objs = new Dictionary<objectbyte>(num);
        foreach (object obj in sequence)
        {
            if (obj != null)
            {
                objs.Item = obj;
            }
            else
            {
                sequenceContainsNull = 1;
            }
        }
        return objs;
    }
  2. Yordan Dikov
    Admin
    Yordan Dikov avatar
    69 posts

    Posted 04 Jul 2011 Link to this post

    Hello Chris,

     Thank you for your feedback. We really appreciate this.

    We were able to reproduce all of you problems. So, we have them on our list now and we are gonna fix them. Please, stay tuned!

    Best wishes,
    Yordan Dikov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
Back to Top