Skip to content

Use GetExportedTypes where possible and filter nested types #723

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

Merged
merged 8 commits into from
Nov 14, 2018

Conversation

filmor
Copy link
Member

@filmor filmor commented Aug 21, 2018

This is basically what @dmitriyse prepared in PR 528 without the event code that I don't understand.

What does this implement/fix? Explain your changes.

Useless calls to load dependencies based on private and nested types.

Does this close any currently open issues?

#703

Any other comments?

...

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

This is basically what @dmitriyse prepared in PR 528 without the event
code that I don't understand.
@filmor filmor requested review from den-run-ai and dmitriyse August 21, 2018 14:01
@filmor
Copy link
Member Author

filmor commented Aug 24, 2018

@denfromufa Any idea for a test?

@den-run-ai
Copy link
Contributor

den-run-ai commented Aug 24, 2018

@filmor i don't have a good option for a test (requires multiple assemblies), unless we ask to test out this PR from all users @goerch @pierce-martin @williamrubens @inna-w @Cronan @barrybriggs @zhukovgreen @AlexCatarino @bobred who reported this in the bug tracker:

#703
#643
#622
#603
#598
#564
#528
MSLNZ/msl-loadlib#6

@codecov
Copy link

codecov bot commented Aug 24, 2018

Codecov Report

Merging #723 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #723      +/-   ##
==========================================
+ Coverage   77.12%   77.14%   +0.01%     
==========================================
  Files          62       62              
  Lines        5583     5583              
  Branches      891      892       +1     
==========================================
+ Hits         4306     4307       +1     
+ Misses        985      980       -5     
- Partials      292      296       +4
Flag Coverage Δ
#setup_linux 64.74% <ø> (ø) ⬆️
#setup_windows 76.41% <100%> (+0.01%) ⬆️
Impacted Files Coverage Δ
src/runtime/assemblymanager.cs 89.17% <100%> (+0.06%) ⬆️
src/runtime/moduleobject.cs 79.77% <0%> (-3.38%) ⬇️
src/runtime/genericutil.cs 82.81% <0%> (-3.13%) ⬇️
src/runtime/runtime.cs 91.37% <0%> (-0.04%) ⬇️
src/runtime/CustomMarshaler.cs 69.86% <0%> (+12.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6417ca...4357b4f. Read the comment docs.

@filmor
Copy link
Member Author

filmor commented Aug 24, 2018

In that case, I'd lean towards merging this as is, if you don't object.

@den-run-ai
Copy link
Contributor

@filmor i think this PR still misses this essential part about handling exceptions from "transitive" dependencies, which I experienced before (I'm going to find a link), see this comment from @Cronan:

https://github.com/pythonnet/pythonnet/pull/528/files#r167013554

@@ -461,5 +458,13 @@ public static Type LookupType(string qname)
}
return null;
}

internal static Type[] GetTypes(Assembly a)
Copy link
Contributor

Choose a reason for hiding this comment

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

need a try-catch block here for transitive depedencies

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't it an error, though, if we can't load transitive dependencies?

Copy link
Contributor

Choose a reason for hiding this comment

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

@filmor i think it is someone else's job to load transitive dependencies, e.g. the direct dependencies should find them on their own:

NuGet/Home#6614

@den-run-ai den-run-ai requested review from vmuriart and yagweb August 24, 2018 15:52
@den-run-ai
Copy link
Contributor

den-run-ai commented Aug 24, 2018

@filmor i agree with your comment about skipassemblyload: #528 (comment)

@codecov
Copy link

codecov bot commented Aug 27, 2018

Codecov Report

Merging #723 into master will increase coverage by 8.32%.
The diff coverage is 70%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #723      +/-   ##
==========================================
+ Coverage   68.55%   76.87%   +8.32%     
==========================================
  Files           1       63      +62     
  Lines         283     5764    +5481     
  Branches        0      911     +911     
==========================================
+ Hits          194     4431    +4237     
- Misses         89     1029     +940     
- Partials        0      304     +304
Flag Coverage Δ
#setup_linux 68.55% <ø> (ø) ⬆️
#setup_windows 76.07% <70%> (?)
Impacted Files Coverage Δ
src/runtime/assemblymanager.cs 87.57% <70%> (ø)
src/runtime/pyansistring.cs 100% <0%> (ø)
src/runtime/constructorbinder.cs 54.54% <0%> (ø)
src/runtime/methodbinder.cs 89.8% <0%> (ø)
src/runtime/Util.cs 37.5% <0%> (ø)
src/runtime/delegatemanager.cs 88.18% <0%> (ø)
src/runtime/eventbinding.cs 46.51% <0%> (ø)
src/runtime/pyiter.cs 77.27% <0%> (ø)
src/runtime/pynumber.cs 100% <0%> (ø)
src/runtime/interop27.cs 100% <0%> (ø)
... and 54 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af394ee...4a3a7a4. Read the comment docs.

@filmor filmor added this to the 2.4.0 milestone Aug 30, 2018
@filmor
Copy link
Member Author

filmor commented Oct 16, 2018

@denfromufa Can you please provide me with a test-case for the transitive dependency issue you mention? I have really no idea what this is about.

@filmor filmor modified the milestone: 2.4.0 Oct 18, 2018
@filmor filmor added the next label Oct 18, 2018
@den-run-ai den-run-ai self-assigned this Oct 18, 2018
// Return all types that were successfully loaded
return exc.Types.Where(x => x != null).ToArray();
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@denfromufa Is this what you had in mind?

Copy link
Contributor

Choose a reason for hiding this comment

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

@filmor this is even more than what i asked for :)

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.

2 participants