SubMain - CodeIt.Right The First Time!

/Community

A Support Community for SubMain Products
 Home Products Services Download Purchase Support
in Search
 
Home Forums Blogs Tutorials Downloads
Welcome to SubMain Community Sign in | Join | Help

bug with Remove unused internal classes Rule.

Last post 06-17-2009, 5:04 PM by Serge B.. 3 replies.
Sort Posts: Previous Next
  •  06-07-2009, 5:11 AM 753

    bug with Remove unused internal classes Rule.

    I get a Remove unused internal classes warning on this code:

            static void Main( string[] args )
            {
                IComparable x=GetInfo(typeof(int));
            }

            static private IComparable GetInfo( Type t )
            {
                Type c=typeof(Info<>).MakeGenericType(t);
                return Activator.CreateInstance(c) as IComparable;
            }

            private class Info<T> : IComparable
            {
                public int CompareTo( object obj )
                {
                    throw new Exception("The method or operation is not implemented.");
                }
            }

    The CodeIt.Right version is 1.6.09156

     Thanks,

    Nadav

     

    Filed under: ,
  •  06-08-2009, 9:03 AM 763 in reply to 753

    Re: bug with Remove unused internal classes Rule.

    Hi Nadav,

    This is a bug indeed. We fixed it and the fix will be available in the next build.

    FYI, the problem was in "typeof(Info<>)" - should it have been something like "typeof(Info<string>)" CodeIt.Right would've not raised the violation.

    But, again, this is fixed now.

    Thanks for reporting the issue!

     


    Thank you,
    Serge Baranovsky
    http://submain.com - .NET Developer Tools  |  Microsoft VB MVP  |  http://vbcity.com - VB Developer Community
    » » (Static Code Analysis + Automatic Refactoring) / Painless Coding Guidelines = CodeIt.Right - http://submain.com/codeit.right
    » » C#/VB .NET Coding Guidelines - FREE 100+ page ebook (PDF) http://submain.com/guidelines
    Filed under: ,
  •  06-17-2009, 3:55 AM 800 in reply to 763

    Re: bug with Remove unused internal classes Rule.

    No shouldn't. If you want to use MakeGenericType() you need a GenericTypeDefinition.

    typeof(Info<>) returns a GenericTypeDefinition.

    typeof(Info<string>) returns a GenericType.

    Nadav

  •  06-17-2009, 5:04 PM 803 in reply to 800

    Re: bug with Remove unused internal classes Rule.

    Hi Nadav,

    Sorry for misunderstanding, I did not mean that you should've used "typeof(Info<string>)", not at all. I meant that CodeIt.Right would've parsed "typeof(Info<string>)" correctly but in your case "typeof(Info<>)" - this is where CIR had a hiccup.

    Anyway, this is fixed and if you need the new temp build right now before we publicly release it, just let me know, I will make it available to you.

    Thanks!

     


    Thank you,
    Serge Baranovsky
    http://submain.com - .NET Developer Tools  |  Microsoft VB MVP  |  http://vbcity.com - VB Developer Community
    » » (Static Code Analysis + Automatic Refactoring) / Painless Coding Guidelines = CodeIt.Right - http://submain.com/codeit.right
    » » C#/VB .NET Coding Guidelines - FREE 100+ page ebook (PDF) http://submain.com/guidelines
View as RSS news feed in XML
 
     
 
Home |  Products |  Services |  Download |  Purchase |  Support |  Community |  About Us |