Roberto Salemi

Roberto Salemi

  • NA
  • 146
  • 140.8k

[WPF] Error in Design Mode

Apr 24 2015 11:25 AM
Hi,

In my UserControl I added:

private void UserControl_Loaded(object sender, RoutedEventArgs e)
{                             
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{
if (_operation.Equals(Definition.SampleDetailOperation.Insert))
{
if(DomainData.GetApplicationVar(ApplicationVars.SmplDefaultPriority) != null)
{
cmbSamplePriority.SelectedValue = DomainData.GetApplicationVar(ApplicationVars.SmplDefaultPriority).Value;
}
}
}
}
In RunTime mode the application works, but in DesignMode there is this error:

Microsoft.Practices.ObjectBuilder2.BuildFailedException
The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, null]) failed: The value can not be null or an empty string. (Strategy type Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy, index 2)

in particular the error is on:
if (DomainData.GetApplicationVar(ApplicationVars.SmplDefaultPriority) != null)

Isn't correct the check:

if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{
//TODO
}
?



Thanks.

Answers (1)