You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.net 10.0 issue with Channeltype does not inherit from channel #97
i am using named pipes i moved to .net10.0 and now i get after a few calls System.ArgumentException: channelType does not inherit from Channel at ServiceWire.NamedPipes.NpClient1..ctor(NpEndPoint npAddress, ISerializer serializer, ICompressor compressor, ILog logger, IStats stats
according to github co pilot the solution might be to cache createdtype.
calling Type t = proxyBuilder.TypeBuilder.CreateTypeInfo(); multiple times might caused the error for .net10.0
suggested changes by copilot
`
internal sealed class ProxyBuilder
{
public string ProxyName { get; set; }
public Type InterfaceType { get; set; }
public Type CtorType { get; set; }
public AssemblyBuilder AssemblyBuilder { get; set; }
public ModuleBuilder ModuleBuilder { get; set; }
public TypeBuilder TypeBuilder { get; set; }
// Cache the created type to avoid calling CreateTypeInfo() multiple times
private Type _createdType;
private readonly object _lockObject = new object();
public Type GetOrCreateType()
{
if (_createdType == null)
{
lock (_lockObject)
{
if (_createdType == null)
{
_createdType = TypeBuilder.CreateTypeInfo();
}
}
}
return _createdType;
}
}
`
`
private static TInterface CreateProxy(ProxyBuilder proxyBuilder, object channelCtorValue, ISerializer serializer, ICompressor compressor, ILog logger, IStats stats) where TInterface : class
{
//create the type and construct an instance
Type[] ctorArgTypes = new Type[] { typeof(Type), proxyBuilder.CtorType, typeof(ISerializer), typeof(ICompressor), typeof(ILog), typeof(IStats) };
// Use the cached type instead of calling CreateTypeInfo() repeatedly
Type t = proxyBuilder.GetOrCreateType();
var constructorInfo = t.GetConstructor(ctorArgTypes);
if (constructorInfo != null)
{
TInterface instance = (TInterface)constructorInfo.Invoke(new object[] { typeof(TInterface), channelCtorValue, serializer, compressor, logger, stats });
return instance;
}
return null;
Thanks for the report. Are you on .NET 10 on client and server? I won't have time to review this until January. You're welcome to fork the code and test the suggestion. Let me know how that goes.
I currently solved it on our side by making the services singletons that use the proxies. I think that is a good solution.
I use client .net 10 and server is framework net48
I also have the same issue. Both my server and client are using .NET 10. When this error occurs, I need to restart the one that has the error—it could be the server or the client.
@tylerje Any chance you can merge #98 and push a new release? The change seems simple/low impact. Happy to assist if that can help move this issue forward!
The reported .NET 10 channel validation failure was fixed before 6.0.0 by replacing the custom inheritance walk with typeof(Channel).IsAssignableFrom(channelType). For 6.0.1, targeted regression coverage now repeatedly creates proxies from a Channel subclass to exercise both the validation and repeated CreateTypeInfo() path on .NET 10 and .NET Framework 4.8. Closing this as completed.
Activity
tylerje commentedon Nov 18, 2025
Thanks for the report. Are you on .NET 10 on client and server? I won't have time to review this until January. You're welcome to fork the code and test the suggestion. Let me know how that goes.
gerbaten commentedon Nov 18, 2025
I currently solved it on our side by making the services singletons that use the proxies. I think that is a good solution.
I use client .net 10 and server is framework net48
tylerje commentedon Nov 18, 2025
Excellent. Yes. That is the correct pattern.
yueeng commentedon Nov 21, 2025
I also have the same issue. Both my server and client are using .NET 10. When this error occurs, I need to restart the one that has the error—it could be the server or the client.
tylerje commentedon Nov 21, 2025
@yueeng did you try the solution @gerbaten found? See above.
IvoTops commentedon Mar 9, 2026
We fixed the issue in our setup. Only one line of ServiceWire code needs to be changed. See pull request.
wouterroos commentedon May 12, 2026
@tylerje Any chance you can merge #98 and push a new release? The change seems simple/low impact. Happy to assist if that can help move this issue forward!
tylerje commentedon Aug 18, 2026
The reported .NET 10 channel validation failure was fixed before 6.0.0 by replacing the custom inheritance walk with
typeof(Channel).IsAssignableFrom(channelType). For 6.0.1, targeted regression coverage now repeatedly creates proxies from aChannelsubclass to exercise both the validation and repeatedCreateTypeInfo()path on .NET 10 and .NET Framework 4.8. Closing this as completed.