@@ -193,8 +193,30 @@ public static void BuildArraySuffix(this IArrayTypeSymbol array, TextWriter trap
193193 trapFile . Write ( ']' ) ;
194194 }
195195
196+ private static void BuildAssembly ( IAssemblySymbol asm , TextWriter trapFile , bool extraPrecise = false )
197+ {
198+ var assembly = asm . Identity ;
199+ trapFile . Write ( assembly . Name ) ;
200+ trapFile . Write ( '_' ) ;
201+ trapFile . Write ( assembly . Version . Major ) ;
202+ trapFile . Write ( '.' ) ;
203+ trapFile . Write ( assembly . Version . Minor ) ;
204+ trapFile . Write ( '.' ) ;
205+ trapFile . Write ( assembly . Version . Build ) ;
206+ if ( extraPrecise )
207+ {
208+ trapFile . Write ( '.' ) ;
209+ trapFile . Write ( assembly . Version . Revision ) ;
210+ }
211+ trapFile . Write ( "::" ) ;
212+ }
213+
196214 static void BuildNamedTypeId ( this INamedTypeSymbol named , Context cx , TextWriter trapFile , Action < Context , TextWriter , ITypeSymbol > subTermAction )
197215 {
216+ bool prefixAssembly = true ;
217+ if ( cx . Extractor . Standalone ) prefixAssembly = false ;
218+ if ( named . ContainingAssembly is null ) prefixAssembly = false ;
219+
198220 if ( named . IsTupleType )
199221 {
200222 trapFile . Write ( '(' ) ;
@@ -217,6 +239,8 @@ static void BuildNamedTypeId(this INamedTypeSymbol named, Context cx, TextWriter
217239 }
218240 else if ( named . ContainingNamespace != null )
219241 {
242+ if ( prefixAssembly )
243+ BuildAssembly ( named . ContainingAssembly , trapFile ) ;
220244 named . ContainingNamespace . BuildNamespace ( cx , trapFile ) ;
221245 }
222246
@@ -245,26 +269,6 @@ static void BuildNamedTypeId(this INamedTypeSymbol named, Context cx, TextWriter
245269
246270 static void BuildNamespace ( this INamespaceSymbol ns , Context cx , TextWriter trapFile )
247271 {
248- // Only include the assembly information in each type ID
249- // for normal extractions. This is because standalone extractions
250- // lack assembly information or may be ambiguous.
251- bool prependAssemblyToTypeId = ! cx . Extractor . Standalone && ns . ContainingAssembly != null ;
252-
253- if ( prependAssemblyToTypeId )
254- {
255- // Note that we exclude the revision number as this has
256- // been observed to be unstable.
257- var assembly = ns . ContainingAssembly . Identity ;
258- trapFile . Write ( assembly . Name ) ;
259- trapFile . Write ( '_' ) ;
260- trapFile . Write ( assembly . Version . Major ) ;
261- trapFile . Write ( '.' ) ;
262- trapFile . Write ( assembly . Version . Minor ) ;
263- trapFile . Write ( '.' ) ;
264- trapFile . Write ( assembly . Version . Build ) ;
265- trapFile . Write ( "::" ) ;
266- }
267-
268272 trapFile . WriteSubId ( Namespace . Create ( cx , ns ) ) ;
269273 trapFile . Write ( '.' ) ;
270274 }
0 commit comments