Skip to content

Fix: DiaSession shows async methods to be external #307

Merged
smadala merged 5 commits intomicrosoft:masterfrom
smadala:dia-session
Dec 30, 2016
Merged

Fix: DiaSession shows async methods to be external #307
smadala merged 5 commits intomicrosoft:masterfrom
smadala:dia-session

Conversation

@smadala
Copy link
Contributor

@smadala smadala commented Dec 28, 2016

@smadala
Copy link
Contributor Author

smadala commented Dec 28, 2016

Verified by Platform tests and manually.
externalasync

out int endLineNumber)
{
var startPoint = methodDebugDefinition.GetSequencePoints().OrderBy(s => s.StartLine).FirstOrDefault();
var startPoint = methodDebugDefinition.GetSequencePoints().OrderBy(s => s.StartLine).FirstOrDefault(s => s.IsHidden == false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s => s.IsHidden == false
What's the purpose of adding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By following reference SequencePointList.cs, SequencePoint.cs, FullSymbolReader.cs IsHidden denotes special point which is not exists in source file. Should be ignored.

startLineNumber = startPoint.StartLine;
var endPoint =
methodDebugDefinition.GetSequencePoints().OrderByDescending(s => s.StartLine).FirstOrDefault();
methodDebugDefinition.GetSequencePoints().OrderByDescending(s => s.StartLine).FirstOrDefault(s => s.IsHidden == false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling same API twice, can we just call it once and then use FirstOrDefault and LastOrDefault method
methodDebugDefinition.GetSequencePoints().OrderBy(s => s.StartLine)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, will change it.

@@ -100,23 +100,22 @@ private void PopulateCacheForTypeAndMethodSymbols(string binaryPath)
var typesDict = asm.GetTypes().ToDictionary(type => type.FullName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of having a dictionary here? I think IEnumerable is what we need.

var methodInfoDict = typeEntry.Value.GetMethods().ToDictionary(methodInfo => methodInfo.Name);
// Get declared method infos
var methodInfoList = ((TypeInfo)typeEntry.Value.GetTypeInfo()).DeclaredMethods;
var methodInfoDict = new Dictionary<string, MethodInfo>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this dictionary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, list will be sufficient.

<Reference Include="System.Xml" />
</ItemGroup>

<ItemGroup>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this service?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VS generates this automatically, to identify it as test project. Explanation here.


DiaSession diaSession = new DiaSession(assemblyPath);
DiaNavigationData diaNavigationData = diaSession.GetNavigationData("SampleUnitTestProject3.Class1", "OverLoadededMethod");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which method's navigation data should it return, there are two methods with the same name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is returning the last method in source file for both full and portable pdb.

@harshjain2
Copy link
Contributor

@AbhitejJohn, @codito @pvlakshm
Is writing Overloaded Test Methods a supported scenario?

I tried it for XUnit, tests got discovered, but two out of three overloaded tests failed.

image

@smadala smadala merged commit 70567de into microsoft:master Dec 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants