Chart FX for WPF uses the built-in licensing support in .NET, this means the following
- At design time, when you drop a chart using the toolbox, VS will add a line into licenses.licx that references our assembly
- When building, VS will embed a license string into your executable as a resource
- At runtime we invoke LicenseManager.Validate in our constructor which will give us access to the embedded string
- Unfortunately .NET needs reflection permission to get this resource, you can verify this by creating a dummy XBAP, add a chart and leave the default Internet zone. It results in the following exception
System.Windows.Markup.XamlParseException: Cannot create instance of 'Chart' defined in assembly 'ChartFX.WPF, Version=8.0.3150.0, Culture=neutral, PublicKeyToken=a1878e2052c08dce'.
The type of the first permission that failed was: System.Security.Permissions.ReflectionPermission
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at System.SecurityUtils.SecureCreateInstance(Type type, Object[] args)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at ChartFX.WPF.Chart.Init()
at ChartFX.WPF.Chart..ctor()
You have a couple of options
1) Setting your app to run with FullTrust or create a Custom zone where you add Reflection to the permissions in the Internet zone (FileDialog, IsolatedStorage, Security, UI, Media and WebBrowser)
2) If this is not possible you can contact us and we can provide a license string you can use with the static Chart.SetLicenseString method.
If you are already using method 2, you might need to contact us again for an updated license string, as the one you are using might have an expiration period.
If you were developing a full trust app (method 1) that used to work, it might be that VS is using a cached license resource, try copying the contents of licenses.licx to a separate file, compile your app, then repaste the string and recompile again. Creating a brand new full trust XBAP might help us know if in fact you are experiencing a problems with VS caching the old license.
Regards,
JuanC