Get field line numbers without using C # parser

I would like to get a string of #s type fields.

Getting the line of # statements in a method is quite simple:

Type type = typeof(MyClass); MethodInfo methodInfo = type.GetMethod("SomeMethod"); int token = methodInfo.MetadataToken; ISymbolReader reader = SymUtil.GetSymbolReaderForFile(@"dllName", null); // from mike stall pdb2xml ISymbolMethod methodSymbol = reader.GetMethod(new SymbolToken(token)); int count = methodSymbol.SequencePointCount; ISymbolDocument[] docs = new ISymbolDocument[count]; int[] startColumn = new int[count]; int[] endColumn = new int[count]; int[] startRow = new int[count]; int[] endRow = new int[count]; method.GetSequencePoints(offsets, docs, startRow, startColumn, endRow, endColumn); 

Unfortunately, it is not enough to get local constructor variables, as some of the type variables may be const / static.

+4
source share

Source: https://habr.com/ru/post/1347985/


All Articles