Custom XAML and CS partial classes with inheritance not recognized as root element of XAML. - by unwrittenrainbow

Status : 

 


1
0
Sign in
to vote
ID 794312 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 7/17/2013 3:34:25 PM
Access Restriction Public

Description

EDIT: This may not technically be a bug, although some additional functionality could be added to avoid the situation. I had another class with the exact same name as the namespace. This kept the XAML compiler from correctly finding the classes. A warning should probably be thrown that naming a class the same as its namespace is not recommended. 



http://stackoverflow.com/questions/17688179/how-do-i-make-custom-xaml-and-cs-partial-classes-with-inheritance?noredirect=1#comment25807283_17688179

Using custom XAML objects, with associated code behind, both were set up to inherit to Option.cs, and then Option.cs was set to inheir to UserControl. The root object of the XAML refused to recognize the Option.cs class. The namespaces were defined correctly. I attempted to put the entire project into Class Library starup mode with no success. I put the Option.cs file into another assembly and it worked flawlessly. I imported the exact same project into MS VS 2010 and it also worked flawlessly.
Sign in to post a comment.
Posted by Microsoft on 7/25/2013 at 12:51 PM
Hello, thank you for bringing this to our attention. After reviewing the project you've provided, we have confirmed that the workaround is to rename the class to something other than the name of the project's namespace. The current behavior is by design, and it seems as though you've discovered this workaround and are unblocked. As a result, we are closing this issue.
Posted by Microsoft on 7/23/2013 at 2:47 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by unwrittenrainbow on 7/22/2013 at 10:47 AM
The attached project demonstrates the problem. A warning should probably be thrown to inform the user the naming a .cs file the same as the namespace can cause issues. Rename WpfApplication1.cs to anything else and the project will successfully build.
Posted by Microsoft on 7/22/2013 at 6:16 AM
Thanks for your feedback. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a demo project so that we can conduct further research?

Please submit this information to us within 4 business days. We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 7/17/2013 at 3:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)