如何定义Dictinary <guid,list <exception>&gt;对于UWP中的运行时指令(Default.rd)?

时间:2016-12-26 15:53:46

标签: c# .net uwp runtime .net-native

到目前为止,我在UWP应用程序中遇到了一些Defualt.rd文件的麻烦。我需要定义Dictinary&gt;到文件,但无论我尝试什么,我失败了。我试过的事情:

<TypeInstantiation Name="Dictionary" Serialize="Required All" Arguments="System.Guid, System.Collections.Generic.List[System.Exception]" Dynamic="Required All" DataContractJsonSerializer="Required All" DataContractSerializer="Required All" />

<TypeInstantiation Name="Dictionary" Serialize="Required All" Arguments="System.Guid, System.Collections.Generic.List`1[System.Exception]" Dynamic="Required All" DataContractJsonSerializer="Required All" DataContractSerializer="Required All"

这是在暂停时从SessionStateService抛出的异常消息:

SerializationCodeIsMissingForType,System.Collections.Generic.Dictionary 2[System.Guid,System.Collections.Generic.List 1 [System.Exception]]

我为运行时指令读取了MSDN页面(here),但是不明白,它太复杂了。我可以定义一个节点泛型类型,如List或Dictinary,但无法找出Dictionary&gt;。

1 个答案:

答案 0 :(得分:1)

rd.xml文件中的通用参数用大括号代替尖括号指定。

Ex:<!DOCTYPE HTML> <html> <head> <title>Traffic lights system</title> </head> <body bgcolor="#5106A5"> <h1 style="text-align:center;font-family:verdana">Traffic light</h1> <div style="text-align:center"> <img alt="Traffic Light" id="TrafficLight" src="red.jpg"></img> </div> <div style="text-align:center"> <button class="button" onclick="changeImage()">Change light</button> <button class="button" onclick="automatic()">Automatic lights</button> <button class="button" onclick="pauseAutomation()">Stop automation</button> </div> <script> var TrafficLightCase = ["red.jpg", 'yellownred.jpg', 'green.jpg', 'yellow.jpg']; var TrafficLightPosition = 0; function changeImage() { TrafficLightPosition++; if (TrafficLightPosition == 4) { TrafficLightPosition = 0; } document.getElementById('TrafficLight').src = TrafficLightCase[TrafficLightPosition]; } function automatic() { time_interval = setInterval(changeImage, 1000); } function pauseAutomation() { clearInterval(time_interval); } </script> 变为System.Collections.Generic.Dictionary<System.Object,System.String>

您可能还会发现这些有用: