Thanks to visit codestin.com
Credit goes to github.com

Skip to content

remove remoting block for .NET standard #1170

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 2 commits into from
Jun 24, 2020

Conversation

koubaa
Copy link
Contributor

@koubaa koubaa commented Jun 23, 2020

What does this implement/fix? Explain your changes.

Remove remoting support

Does this close any currently open issues?

Removes some dependency on .NET framework

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

@lostmsu
Copy link
Member

lostmsu commented Jun 23, 2020

If this is the only line where it is used, can we replace it with runtime feature detection instead of completely removing a feature?

E.g.

static readonly Func<object, bool> IsTransparentProxy = GetIsTransparentProxy();

static bool Never(object _) => false;

static Func<object, bool> GetIsTransparentProxy() {
  var remoting = typeof(int).Assembly.GetType("System.Runtime.Remoting.RemotingServices");
  if (remoting is null) return Never;

  var isProxy = remoting.GetMethod("IsTransparentProxy", new []{typeof(object)});
  if (isProxy is null) return Never;

  return (Func<object, bool>)Delegate.CreateDelegate(
    typeof(Func<object, bool>), isProxy,
    throwOnBindFailure: true);
}

P.S. @filmor Travis CI results are not being picked up...

@koubaa
Copy link
Contributor Author

koubaa commented Jun 23, 2020

@lostmsu its a good idea but this isn't a tested feature and I don't want to build a test for it. Are you confident your code will work without tests?

@lostmsu
Copy link
Member

lostmsu commented Jun 23, 2020

@koubaa the calls to this method probably have some coverage, so if it crashes, we should see in CI. The feature itself might be broken with this, but IMO it is better, than removing it completely.

Besides, I did some testing:

.NET Framework

> using System;
> static bool Never(object _) => false;
>
> static Func<object, bool> GetIsTransparentProxy() {
.   var remoting = typeof(int).Assembly.GetType("System.Runtime.Remoting.RemotingServices");
.   if (remoting is null) return Never;
.
.   var isProxy = remoting.GetMethod("IsTransparentProxy", new []{typeof(object)});
.   if (isProxy is null) return Never;
.
.   return (Func<object, bool>)Delegate.CreateDelegate(
.     typeof(Func<object, bool>), isProxy,
.     throwOnBindFailure: true);
. }
> var d = GetIsTransparentProxy();
> d
Func<object, bool> { Method=[Boolean IsTransparentProxy(System.Object)], Target=null }
> d(new object())
false

.NET Core

> Console.WriteLine(IsTransparentProxy.Method);
Boolean Never(System.Object)

Mono

> var d = GetIsTransparentProxy();
> d
Func<object, bool> { Method=[Boolean IsTransparentProxy(System.Object)], Target=null }

@koubaa
Copy link
Contributor Author

koubaa commented Jun 24, 2020

@lostmsu as long as I'm not signing up for testing remoting, I am ok with that. I'll push an update with your change and remove the changelog entry

@lostmsu
Copy link
Member

lostmsu commented Jun 24, 2020

@koubaa , yeah, let's do that.

@koubaa koubaa changed the title remove remoting remove remoting block for .NET standard Jun 24, 2020
@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2020

Codecov Report

Merging #1170 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1170   +/-   ##
=======================================
  Coverage   86.25%   86.25%           
=======================================
  Files           1        1           
  Lines         291      291           
=======================================
  Hits          251      251           
  Misses         40       40           
Flag Coverage Δ
#setup_linux 64.94% <ø> (ø)
#setup_windows 72.50% <ø> (ø)

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 ec424bb...82bdb9a. Read the comment docs.

@lostmsu lostmsu merged commit 7a9dcfa into pythonnet:master Jun 24, 2020
AlexCatarino pushed a commit to QuantConnect/pythonnet that referenced this pull request Jun 29, 2020
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.

4 participants