- // TODO : Need to check capability of supporting profiles
- var profile = Activator.CreateInstance<T>();
- profile.RemoteAddress = RemoteDeviceAddress;
- return profile;
+ try
+ {
+ // TODO : Need to check capability of supporting profiles
+ var profile = (T)Activator.CreateInstance(typeof(T), true);
+ profile.RemoteAddress = RemoteDeviceAddress;
+ return profile;
+ }
+ catch (TargetInvocationException err)
+ {
+ throw err.InnerException;
+ }