Instead of creating objects using the new operator, some classes may use reflection instead, as shown below:
// Create the control as usual
// var ctl = new SilverlightControl1();
// Create the control using reflection
var asm = System.Reflection.Assembly.GetExecutingAssembly();
var type = asm.GetType("XapOptimizerTest.SilverlightControl1");
var ctor = type.GetConstructor(System.Type.EmptyTypes);
Control ctl = ctor.Invoke(null) as Control;
In this example, XapOptimizer will not be able to determine that the SilverlightControl1 class is used by the project and will prune it from the application, causing it to fail.
In cases such as this, you need to tell the XapOptimizer not to prune or obfuscate the SilverlightControl1 class. This is done by adding options to the XapOptimizer project, see Working with XapOptimizer for more information.