diff options
author | Miguel Costa <miguel.costa@qt.io> | 2018-11-28 12:38:31 +0100 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2018-11-29 10:12:20 +0000 |
commit | f5d35b22140a80d0ab4d0f92d24fe2074725a3f8 (patch) | |
tree | ab129ec20e5ed9e515952d7cf8bc751c05ce5e7c | |
parent | 1ffd6fc620195523dc29173780cc92373454928a (diff) |
Fix code analysis error
This patch fixes the following code analysis error:
MSBUILD : error : CA0001 : An error was encountered while parsing IL
for method: 'QtVsTools.Qml.Debug.AD7.InfoHelper`1+Mapping`2
+<GetEnumerator>d__10.MoveNext', instruction at offset '0xD' with
opcode 'Ldfld'.
This error, though not reported by the C# compiler -- which generates
IL code that is apparently correct -- is nevertheless reported by the
code analysis step that runs at the end of the Release build. This seems
due to a stricter interpretation of the 'yield return' statement.
Specifically, whether it is allowed in a method returning IEnumerator.
On the other hand, calling the list's own GetEnumerator instead of
iterating that list seems like the better approach.
Change-Id: I100bf1421f53d4a25e1fb9f04336bc3f5f78407c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/qtvstools/QML/Debugging/AD7/QmlDebugAD7InfoHelpers.cs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/qtvstools/QML/Debugging/AD7/QmlDebugAD7InfoHelpers.cs b/src/qtvstools/QML/Debugging/AD7/QmlDebugAD7InfoHelpers.cs index 88195d0b..f4abd584 100644 --- a/src/qtvstools/QML/Debugging/AD7/QmlDebugAD7InfoHelpers.cs +++ b/src/qtvstools/QML/Debugging/AD7/QmlDebugAD7InfoHelpers.cs @@ -142,8 +142,7 @@ namespace QtVsTools.Qml.Debug.AD7 public IEnumerator<MapField<TStruct, TFieldMask>> GetEnumerator() { - foreach (var item in fieldMaps) - yield return item; + return fieldMaps.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() |