Red Gate forums :: View topic - Merge assembly wrong if its class is used in attribute.
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 5
SmartAssembly 5 forum

Merge assembly wrong if its class is used in attribute.

Search in SmartAssembly 5 forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
mousehuang



Joined: 17 Nov 2010
Posts: 4

PostPosted: Wed Nov 17, 2010 10:12 am    Post subject: Merge assembly wrong if its class is used in attribute. Reply with quote

Have one assembly ClassLibrary1:
Code:
namespace ClassLibrary1
{
    public class ClassA
    {
    }

    public class ClassB
    {
    }
}

And another assembly ClassLibrary2:
Code:
namespace ClassLibrary2
{
    [System.ComponentModel.LicenseProvider(typeof(ClassLibrary1.ClassB))]
    [System.ComponentModel.TypeConverter(typeof(ClassLibrary1.ClassA))] //PROBLEM! It still reference to the old ClassLibrary1.   
    public class Class1
    {
       
        public void Method1()
        {
            Type t = typeof(ClassLibrary1.ClassA); //OK! It reference to the new merged class in ClassLibrary2           
            ClassLibrary1.ClassB b = new ClassLibrary1.ClassB();
            Console.WriteLine(t.ToString());
        }
    }
}

ClassLibrary1 is referenced by ClassLibrary2. I tried to merge ClassLibrary1 into ClassLibrary2. The build is successful. The type "ClassLibrary1.ClassA" used in the Method1 reference to the new merged class in new ClassLibrary2. It is OK. But the type "ClassLibrary1.ClassA" used in the TypeConverterAttribute still reference to the old ClassLibrary1. Enven if its name is obfuscated to the new merged class in new ClassLibrary2. It is wrong.
This problem occurs after upgrating from {SA} 3 to {SA} 5.5. Is it a problem or some settings I should take care are missing?
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 594

PostPosted: Thu Nov 18, 2010 6:19 pm    Post subject: Reply with quote

I'm sorry - I'm a little bit confused- are you showing the code before it gets processed or after (i.e. the Reflector output)?

If its before the porcesing- why are you using the TypeConvertor attributes and how exactly are you expecting smartassembly to deal with them?
Back to top
View user's profile Send private message
mousehuang



Joined: 17 Nov 2010
Posts: 4

PostPosted: Fri Nov 19, 2010 4:24 am    Post subject: Reply with quote

The code is before obfuscate. Since the ClassLibrary1 is merged to ClassLibrary2, the code of problem line after obfuscate should be: (if ClassLibrary1.ClassA is renamed to "CL1.CA"):
[System.ComponentModel.TypeConverter(typeof([ClassLibrary2:]CL1.CA))].
But now it is:
[System.ComponentModel.TypeConverter(typeof([ClassLibrary1:]CL1.CA))]
Do you notice the problem. The class name changes to "CL1.CA", but the referenced assembly is still ClassLibrary1. It should reference to the new ClassLibrary2, since the class is merged to it.

BTW, the TypeConvertorAttribute is used for design time support.
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 594

PostPosted: Mon Nov 22, 2010 2:04 pm    Post subject: Reply with quote

Thank you for the extra clarification- I am going to have to ask for help from one of our experts- please wait while I do this...
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 594

PostPosted: Mon Nov 22, 2010 2:35 pm    Post subject: Reply with quote

Looks like this is just not yet supported- sorry. I will log a bug and this will get seen to at some point (I cannot be specific about when).
Back to top
View user's profile Send private message
mousehuang



Joined: 17 Nov 2010
Posts: 4

PostPosted: Tue Nov 23, 2010 1:34 am    Post subject: Reply with quote

Thanks for you reply. Waiting...
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 594

PostPosted: Fri Nov 26, 2010 3:53 pm    Post subject: Reply with quote

Looks like we fixed it straight away. Please test with our early access release (installs side-by-side with current version):

http://www.red-gate.com/messageboard/viewtopic.php?t=12254
Back to top
View user's profile Send private message
mousehuang



Joined: 17 Nov 2010
Posts: 4

PostPosted: Tue Nov 30, 2010 7:15 am    Post subject: Reply with quote

It works now. Thanks for you effort. It is noticed that the new version is 6.0. When will the 6.0 be released to public? We had just bought the server license for 5.5, is that license working for 6.0?
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 594

PostPosted: Mon Dec 13, 2010 4:16 pm    Post subject: Reply with quote

It should be publically available in January (sorry, can't be more specific). The version 5 license won't apply but if you have a current maintenance contact we will create a new code for you.
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group