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

Unix sockets support #499

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ArtManyak
Copy link
Member

No description provided.

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net35;net472</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Before merging, we'll have to restore the compatibility with the older frameworks.

Comment on lines +151 to +152
instance = Activator.CreateInstance(implementingType)
?? throw new InvalidOperationException($"Unable to create instance of: {implementingType.ToString(true)}");
Copy link
Collaborator

Choose a reason for hiding this comment

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

(MInor) Sorry, why this change? It is not practical to expect null from Activator.CreateInstance: it will only return null if you pass a Nullable as the implementingType. It will throw an exception by itself otherwise; it doesn't need our additional assertion here.

Comment on lines +151 to +152
var elementType = typeInfo.GetElementType();
if (elementType == null) return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should never be null here, I'd prefer this code to fail in such a case (as it was before) instead of trying to handle the logic error.

@@ -68,13 +68,13 @@ internal static FieldInfo[] GetBindableFields(TypeInfo typeInfo)
return list.ToArray();
}

private static IEnumerable<FieldInfo> GetFields(Type type, Type baseType)
private static IEnumerable<FieldInfo> GetFields(Type? type, Type baseType)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Huh, should type really be nullable here? Who calls this on a null type?

Comment on lines +528 to +529
public Client(Lifetime lifetime, IScheduler scheduler, string path, string? optId = null) :
this(lifetime, scheduler, EndPointWrapper.CreateUnixEndPoint(path), optId) {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

(Minor) Since this an unusual use case, I'd prefer to have something other than a string in here. Let's maybe make a separate struct, like this?

public struct UnixSocketConnectionParams
{
  public string Path { get; set; }
}

and then

public Client(Lifetime lifetime, IScheduler scheduler, UnixSocketConnectionParams connectionParams, string? optId = null)

WDYT?

Comment on lines +25 to +35
// [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
[Obsolete("Obsolete")]
protected RdFault(SerializationInfo info, StreamingContext context) : base(info, context)
{
ReasonTypeFqn = info.GetString(nameof(ReasonTypeFqn));
ReasonText = info.GetString(nameof(ReasonText));
ReasonMessage = info.GetString(nameof(ReasonMessage));
}

[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
// [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

A note to not forget to do something about these eventually. I'm not sure we use them at all.

}
}
#endif
// #if !NET35
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note to uncomment it eventually :)

Comment on lines 3 to 5
<!--suppress MsbuildTargetFrameworkTagInspection -->
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks Condition=" $(OS) == 'Windows_NT' ">net472;$(TargetFrameworks);net35</TargetFrameworks>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is broken.

Comment on lines 3 to +5
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't forget to port this to both platforms somehow.

@@ -1,6 +0,0 @@
{
"sdk": {
"version": "6.0.100",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's update it to net8 better :)

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