Open CZEMacLeod opened 8 years ago
Thanks @CZEMacLeod for reporting it, we know about it and working on a fix. For now, if you can disable compilation with .Net Native, it should work.
I'm having the same issue, but not able to create the package and facing some errors as well
Error at SerializationAssemblyGenerator.Program.AddKnownContractsLists(McgCodeTypeDeclaration container, ContractTables tables) Error at SerializationAssemblyGenerator.Program.GenerateDataContractSerializerHelper(IEnumerable1 contracts, IEnumerable1 jsonContracts, GeneratorSettings settings, String intermediateAssembly, IEnumerable1 wcfSerializers) Error at SerializationAssemblyGenerator.Program.GenerateDataContractSerializerHelperCode(IEnumerable1 contracts, IEnumerable1 jsonContracts, IEnumerable1 wcfSerializers) Error at SerializationAssemblyGenerator.Program.Main(String[] args) Error at System.Collections.Generic.Dictionary2.get_Item(TKey key)
Been a while, no activity on this it seems. Is there a workaround for this or does the runtime basically block tbs.dll api at runtime for .Net Native and the only solution is wait for the SDK to support these? Does this mean we can't publish these apps to the store? For IoT native compilation makes a big difference.
To get rid of the serialization generation error you can do this https://github.com/Microsoft/TSS.MSR/issues/8
Not much help however, complies but does not run.
We have a plan to fix this, but it will take a while. One work-around could be to use ProcessLauncher to launch limpet.exe outside of UWP and collect its output. We are working on a project that utilizes this approach, it will go public in about a month. I'll update this issue with a link.
I see, what is the actual blocking issue here though? Because it looks like .Net Native is not allow access to native methods in tbl.dll!?
Correct, TBS APIs are currently not allowed in UWP.
Could UWP on Windows IoT expose TBS APIs directly via Windows IoT Extensions for UWP? It seems to expose others such as ShutdownManger.
After what will soon be a year is there seriously no real solution to this from the UWP platform itself? Does not inspire confidence. TPM on IoT is somewhat essential. And without .Net Native support we can't publish to Windows Store to get the IoT device to auto update (currently on way supported).. Perhaps we need to turn to other platforms.
We just faced with this blocking point for our IoT project that is UWP on Windows IoT Core connecting to Azure IoT Hub and having Azure connection information (hub name, device id, device key) saved in TPM of an IoT device. It looks like an absolutely normal real world scenario, but for some reason this case is missed, and we cannot have the auto update through the store by this way.
Here is a work-around that you can use until we get the TBS APIs fixed for UWP:
async Task<string> GetConnectionStringFromTPM()
{
var processLauncherOptions = new ProcessLauncherOptions();
var standardOutput = new InMemoryRandomAccessStream();
processLauncherOptions.StandardOutput = standardOutput;
processLauncherOptions.StandardError = null;
processLauncherOptions.StandardInput = null;
var processLauncherResult = await ProcessLauncher.RunToCompletionAsync(@"c:\windows\system32\limpet.exe", "0 -ast", processLauncherOptions);
if (processLauncherResult.ExitCode == 0)
{
using (var outStreamRedirect = standardOutput.GetInputStreamAt(0))
{
var size = standardOutput.Size;
using (var dataReader = new DataReader(outStreamRedirect))
{
var bytesLoaded = await dataReader.LoadAsync((uint)size);
var stringRead = dataReader.ReadString(bytesLoaded);
var result = stringRead.Trim();
return result;
}
}
}
else
{
throw new Exception("Cannot get connection string");
}
}
Two things before you can run this:
systemManagement
capability enabled in appxmanifest file:
<Capabilities>
<Capability Name="internetClient" />
<iot:Capability Name="systemManagement" />
</Capabilities>
reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher" /v AllowedExecutableFilesList /t REG_MULTI_SZ /d "c:\windows\system32\limpet.exe\0"
More info on ProcessLauncher is here.
Any news on this subject?
Any progress on this?
Not yet, this is going to take us a bit longer. Is the work-around above not acceptable?
I did finally get the workaround to work. Thanks!
Are TBS APIs fixed now with Creators or Fall update?
Does anyone know the command line arguments for limpet.exe? In particular for the -ast argument. I would like to not have it expire. or at least set it for the maximum value.
it is possible, that this feature does not work at all with the newest update (Windows 10 IoT Core 16299)? The azure connector went down on 200 devices in the field ...
Other issue: provision a new device with Azure using IoT Dashboard app, this code can no longer read the device identity.
Are there any updates on this? Microsoft.Devices.Tpm haven't been updated since last year and no effort seems to have been made to address this issue. Is Microsoft giving up on Windows IoT and Azure iot Hub?
When compiling in Release mode after adding a connection with Hardware Security I get the following
When running the code there are 6 TypeLoadExceptions in TSS.UWP.dll and the values from GetHostName() etc. are all empty.
Exception thrown: 'System.TypeLoadException' in TSS.UWP.dll
I don't know if this is an issue with something missing from the project that the extension should add or an issue with the TPM packages themselves.
The code runs as expected and returns the values when in Debug mode.