Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: DiaSession shows async methods to be external #307

Merged
merged 5 commits into from
Dec 30, 2016
Merged

Fix: DiaSession shows async methods to be external #307

merged 5 commits into from
Dec 30, 2016

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

@@ -97,10 +97,10 @@ internal static MethodDebugInformationHandle GetMethodDebugInformationHandle(Met
out int startLineNumber,
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.

<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System.Runtime" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<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