[Bluetooth] Fix GetProfile API issue (#641)
authorWootak <nonsan1228@gmail.com>
Tue, 8 Jan 2019 07:33:27 +0000 (16:33 +0900)
committerGitHub <noreply@github.com>
Tue, 8 Jan 2019 07:33:27 +0000 (16:33 +0900)
Fix to find non-public constructor by using
 CreateInstance(Type type, bool nonPublic) API
 with nonPublic=true.

src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothDevice.cs

index f40c7c8..d697473 100644 (file)
@@ -681,7 +681,7 @@ namespace Tizen.Network.Bluetooth
         public T GetProfile<T>() where T : BluetoothProfile
         {
             // TODO : Need to check capability of supporting profiles
-            var profile = Activator.CreateInstance<T>();
+            var profile = (T)Activator.CreateInstance(typeof(T), true);
             profile.RemoteAddress = RemoteDeviceAddress;
             return profile;
         }