Search code examples
c#.netuwpruntime.net-native

How to define Dictionary<Guid,List<Exception>> for Runtime Directives (Default.rd) in UWP?


So far so long, I've been having some troubles with Defualt.rd file in my UWP app. I need to define Dictinary> to the file but whatever I tried I failed. Things I tried:

<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"

This is the exception message being thrown from SessionStateService on suspension:

SerializationCodeIsMissingForType, System.Collections.Generic.Dictionary2[System.Guid,System.Collections.Generic.List1[System.Exception]]

I read the MSDN page (here) for runtime directives but didn't understand a thing, it was so complicated. I can define one noded generic types like List or Dictinary but couldn't figure out Dictionary>.


Solution

  • Generic parameters in rd.xml files are specified with curly braces in place of the angle brackets.

    Ex: System.Collections.Generic.Dictionary<System.Object,System.String> becomes System.Collections.Generic.Dictionary{System.Object,System.String}.

    You may also find these helpful: