File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
ICSharpCode.Decompiler/TypeSystem/Implementation Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -842,7 +842,18 @@ private bool ComputeIsRecord()
842842 opInequality |= metadata . StringComparer . Equals ( method . Name , "op_Inequality" ) ;
843843 clone |= metadata . StringComparer . Equals ( method . Name , "<Clone>$" ) ;
844844 }
845- return getEqualityContract & toString & printMembers & getHashCode & equals & opEquality & opInequality & clone ;
845+ // relaxed check for toString:
846+ // record classes may have their ToString implementation only in the base class,
847+ // so we cannot check for it here, as the type hierarchy is not yet known.
848+ // usually, the existence of a "<Clone>$" and "get_EqualityContract" method should
849+ // be a good enough indicator.
850+ // in record structs we require a ToString implementation, because the PrintMembers
851+ // method needs to be called.
852+ if ( isStruct && ! toString )
853+ {
854+ return false ;
855+ }
856+ return getEqualityContract & printMembers & getHashCode & equals & opEquality & opInequality & clone ;
846857 }
847858 #endregion
848859 }
You can’t perform that action at this time.
0 commit comments