On the full framework, WCF looks for any attributes declared on a type where the attribute type derives from IServiceBehavior. This works on the full framework, but on .Net Core an ArgumentException is thrown with the message "Type passed in must be derived from System.Attribute or System.Attribute itself." Here is a simple repro which runs to completion on the full framework but throws on .Net Core.
usingSystem.Reflection;usingSystem.ServiceModel;usingSystem.ServiceModel.Description;classProgram{staticvoidMain(string[]args){varti=typeof(MyService).GetTypeInfo();varattrs=ti.GetCustomAttributes(typeof(IServiceBehavior),false);}[ServiceContract]publicinterfaceIMyService{[OperationContract]stringHello(stringhello);}publicclassMyService:IMyService{publicstringHello(stringhello){returnhello;}}}
On the full framework, WCF looks for any attributes declared on a type where the attribute type derives from IServiceBehavior. This works on the full framework, but on .Net Core an
ArgumentExceptionis thrown with the message "Type passed in must be derived from System.Attribute or System.Attribute itself." Here is a simple repro which runs to completion on the full framework but throws on .Net Core.