-
Notifications
You must be signed in to change notification settings - Fork 471
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
Remove obsolete or redundant conditional compilation symbols #501
Comments
|
|
WRT binary serialisation, you can serialise a proxy so it serialises the target, however is there anything else we are supporting (ignoring the serialisation code there for the save/load assembly dance). Serialising a proxy isn't something people have asked for on .NET Core likely because no one is writing new code using binary serialisation. I'm hesitant to add the feature to the .NET Standard build just because we could sort of do it. I think we have to work out which conditional compilation could be changed to |
Let me see if I can get this straight.
and with both (2) and (3), there's not just binary serialization to consider, but also XML serialization (and while we're at it, these days, we should at least mention With (1), I'm mostly concerned about serializability of I'm not sure I fully grasp the importance of (2) and (3). I guess people might use mocking libraries to easily generate objects, then expect those to format just as nicely as the mocked/proxied base type for transmission across a wire... but would anyone want to deserialize a proxy or invocation? Not sure whether that's an important scenario but I tend towards "not important"; don't use proxies as DTOs. (4) should be easy, at least. |
Great summary, and I too am not sure how much of everything is important. (1) We've always had problems with serialization of types involved in the pre-generated assembly process, you can always have an interceptor, interceptor selector, mixin, etc that just can't be serialized properly, but no one has reported any defects with this in the last decade I can recall, so either so few people use this feature, people only use it for simple interceptors, or people worked out their problem and fixed their code to be serializable. My guess is it is mostly number 1, this feature has extremely limited use with partial trust web hosting a non-existent thing today, security is done by the OS not the runtime, not sure we can really offer this feature reliably anyway, too high of a risk of unbounded object graphs. We could consider dropping this and adding something better back in the future that was actually reliable if/when the need arises. What would we do for unit tests though. (2) and (3) Maybe instead of DP doing this since we obviously don't support serialization for every possible different library someone could want to use (we've never had (4) There is probably little harm in just following the .NET Framework coding guidelines for making all exceptions serializable, but do you know if this is still the guidelines for .NET Core? I see for example |
I didn't quite dare suggest it myself, but I'm also favor of removing serializability for (1), (2), and (3) and only gradually add back the bits people really need. Could Windsor possibly be a roadblock here? When you mention unit tests, I assume you're thinking of being able to run PEVerify? I could be wrong, but that ought to still work even without serializability. Regarding (4), I guess framework exception types are still made |
I am going to close this issue. I've removed as many conditional compilation symbols as is currently possible without removing actual features. The discussion about whether or not serialization support should be removed probably deserves a dedicated issue. |
PR #495 removed approx. half of all conditional compilation symbols, but a few are left. This issue is a follow-up to @jonorossi comment in said PR:
As to how more of those symbols can be removed, I would need to take a closer look. Right now, I'm assuming the following:
FEATURE_SERIALIZATION
[Serializable]
attribute... but the binary serializer can't deal with e.g.Type
nor delegates, so we can't easily enable this on .NET Core). But: This symbol is closely related toFEATURE_APPDOMAIN
&FEATURE_ASSEMBLYBUILDER_SAVE
, perhaps we could merge those into one.FEATURE_REMOTING
IsTransparentProxy
checks /MarshalByRefObject
. (Is this something that's still used these days? For which types? I don't know.)FEATURE_EVENTLOG
Castle.Core.Logging.DiagnosticsLogger
, which logs to Windows' event log.FEATURE_SYSTEM_CONFIGURATION
Castle.Core.Resource
namespace, which we could deprecate/remove.FEATURE_TEST_PEVERIFY
PEVERIFY
to the PEVerify binary's location. (Setting an environment variable in an MSBuild project file might be non-trivial, but perhaps it can be done.)FEATURE_TEST_COM
CoCreateInstance
, but AFAIK it does support COM interop and the COM attributes. So it may be possible to reduce usage of this attribute.The text was updated successfully, but these errors were encountered: