KB Article K18288
Visible to All Users

Why do I get the NullReferenceException after upgrading to a newer version when using custom skins?

Description:
After upgrading to XXX version, I get the NullReferenceException exception ("Object reference is not set to an instance of an object")  when using custom skins. Why does this problem occur, and how to overcome it?

Answer:
This problem can occur after the upgrade if we add or change elements in our skins. After upgrading our components to a new major version, you need to rebuild your custom skin libraries via the SkinEditor utility:

  1. Open your project.
  2. Remove references to your custom skin libraries.
  3. Remove corresponding skin DLLs from the project folder (and from GAC, if you installed them here).
  4. Open the custom skin's sources via SkinEditor and create a new assembly.
  5. Add a reference to this assembly in your project.

Another problem is that the error message can be shown if you try to open a skin created with a previous version in the Skin Editor. We constantly improve our skins by adding new elements to them. When you are opening a skin via the Skin Editor, it tries to obtain all necessary elements. If a specific element is not found in the skin, the Skin Editor tries to find it in the parent skin and updates your skin accordingly. That's why if you make your custom skin a descendant of our skin, it will be opened without any problem, because newly introduced elements will be found in the base class. However, if your skin has no parent, the Skin Editor can't find some necessary elements, and the exception is thrown. To solve the problem, it's necessary to specify a parent for your custom skin (the *.skin file):

XML
<SkinItems version="1.0" application="SkinEditor" assembly="MyAssembly" class="" extranamespace=""> <Item> <ItemName>MyCustomSkin1</ItemName> <TemplateName>Caramel</TemplateName> <------------------ Parent exists </Item> <Item> <ItemName>MyCustomSkin2</ItemName> <TemplateName>Caramel</TemplateName> <------------------ Parent exists </Item> <Item> <ItemName>MyCustomSkin3</ItemName> <TemplateName>Caramel</TemplateName> <------------------ Parent exists </Item> <Item> <ItemName>MyCustomSkin4</ItemName> <TemplateName>MyCustomSkin4</TemplateName> <-------------------- No parent. Needed to be changed : <TemplateName>Caramel</TemplateName> </Item> <Item> <ItemName>MyCustomSkin5</ItemName> <TemplateName>MyCustomSkin5</TemplateName> </Item> </SkinItems>

See also:
Troubleshooting - Skins and Skin Editor

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.