private static unsafe void ParseConfigurationPackages(NativeRuntime.IFabricCodePackageActivationContext nativeContext, ServiceManifest manifest) { IList <string> names = new List <string>(); NativeCommon.IFabricStringListResult nativeResult = nativeContext.GetConfigurationPackageNames(); uint count; IntPtr nativeNames = nativeResult.GetStrings(out count); for (int i = 0; i < count; i++) { NativeRuntime.IFabricConfigurationPackage configPackageResult = nativeContext.GetConfigurationPackage(Marshal.ReadIntPtr((IntPtr)(nativeNames + i))); NativeTypes.FABRIC_CONFIGURATION_PACKAGE_DESCRIPTION nativeDescription = *(((NativeTypes.FABRIC_CONFIGURATION_PACKAGE_DESCRIPTION *)configPackageResult.get_Description())); NativeRuntime.IFabricConfigurationPackage nativePackage = null; string packageName = NativeTypes.FromNativeString(nativeDescription.Name); using (var pin = new PinBlittable(packageName)) { nativePackage = nativeContext.GetConfigurationPackage(pin.AddrOfPinnedObject()); } manifest.ConfigurationPackages.Add(ConfigurationPackage.CreateFromNative(nativePackage)); GC.KeepAlive(configPackageResult); } GC.KeepAlive(nativeResult); }
internal static unsafe ConfigurationPackageDescription CreateFromNative( NativeTypes.FABRIC_CONFIGURATION_PACKAGE_DESCRIPTION nativeDescription, string path, ConfigurationSettings settings) { string packageName = NativeTypes.FromNativeString(nativeDescription.Name); AppTrace.TraceSource.WriteNoise("DataPackageDescription.CreateFromNative", "PackageName {0}", packageName); return(new ConfigurationPackageDescription { Name = packageName, Version = NativeTypes.FromNativeString(nativeDescription.Version), ServiceManifestName = NativeTypes.FromNativeString(nativeDescription.ServiceManifestName), ServiceManifestVersion = NativeTypes.FromNativeString(nativeDescription.ServiceManifestVersion), #pragma warning disable 618 Path = path, Settings = settings #pragma warning restore 618 }); }