Skip to content

Conversation

@MaximLipnin
Copy link
Contributor

@MaximLipnin MaximLipnin commented Aug 20, 2020

The following methods from System.Collections.* namespaces were listed by the platform compatibility analyzer (https://github.com/dotnet/platform-compat) as throwing PNSE on Browser WASM so they can be marked as unsupported using
UnsupportedOSPlatformAttribute("browser") attribute:

DocID Namespace Type Member Nesting
M:System.Collections.Generic.LinkedList`1.Enumerator.System#Runtime#Serialization#ISerializable#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) System.Collections.Generic LinkedList+Enumerator System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo, StreamingContext) 0
M:System.Collections.Generic.LinkedList`1.Enumerator.System#Runtime#Serialization#IDeserializationCallback#OnDeserialization(System.Object) System.Collections.Generic LinkedList+Enumerator System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(Object) 0
M:System.Collections.Generic.SortedSet`1.Enumerator.System#Runtime#Serialization#ISerializable#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) System.Collections.Generic SortedSet+Enumerator System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo, StreamingContext) 0
M:System.Collections.Generic.SortedSet`1.Enumerator.System#Runtime#Serialization#IDeserializationCallback#OnDeserialization(System.Object) System.Collections.Generic SortedSet+Enumerator System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(Object) 0
M:System.Collections.Specialized.NameObjectCollectionBase.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) System.Collections.Specialized NameObjectCollectionBase .ctor(SerializationInfo, StreamingContext) 0
M:System.Collections.Specialized.NameObjectCollectionBase.OnDeserialization(System.Object) System.Collections.Specialized NameObjectCollectionBase OnDeserialization(Object) 0
M:System.Collections.Specialized.NameObjectCollectionBase.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) System.Collections.Specialized NameObjectCollectionBase GetObjectData(SerializationInfo, StreamingContext) 0
M:System.Collections.Specialized.NameValueCollection.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) System.Collections.Specialized NameValueCollection .ctor(SerializationInfo, StreamingContext) 1

Part of #41087

@ghost
Copy link

ghost commented Aug 20, 2020

Tagging subscribers to this area: @safern, @ViktorHofer
See info in area-owners.md if you want to be subscribed.

Initialize();
}

[UnsupportedOSPlatform("browser")]
Copy link
Member

Choose a reason for hiding this comment

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

This throws everywhere. Why mark it as unsupported for browser only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's good question, thanks. I'm not sure if there is something like [UnsupportedOSPlatform("all")] to mark it for all the possible platforms. So in this case I've done it only for the related part.

Copy link
Member

Choose a reason for hiding this comment

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

cc: @jeffhandley @adamsitnik did we consider an "all" value for the analyzer?

Copy link
Member

Choose a reason for hiding this comment

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

Would [Obsolete] be more appropriate for something not supported anywhere?

This makes me feel uneasy saying it, but I think you could pull off "not supported anywhere" by using [SupportedOSPlatform("none")]; I don't think I would endorse it though.

Copy link
Member

Choose a reason for hiding this comment

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

I would start with some better examples than this one.

The binary serialization methods touched in this PR are on interfaces and/or not meant to be directly called by user code. It means that the annotations on them are not going to make any difference in user experience. I think that the right action for these specific methods may be to do nothing and leave them alone.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I agree these ones we should not annotate them at all. I was just wondering if we should support an annotation for "ALL" platforms.

Copy link
Member

Choose a reason for hiding this comment

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

I was just wondering if we should support an annotation for "ALL" platforms.

I'll follow up on that off this issue

@jkotas
Copy link
Member

jkotas commented Aug 20, 2020

I am not sure whether it makes sense to start marking the binary serialization support methods as unsupported. @GrabYourPitchforks Do you have thoughts on this?

The binary serialization support methods are not meant to be directly called by user code, so marking them as unsupported via attributes does not provide much value.

@MaximLipnin
Copy link
Contributor Author

I am not sure whether it makes sense to start marking the binary serialization support methods as unsupported. @GrabYourPitchforks Do you have thoughts on this?

The binary serialization support methods are not meant to be directly called by user code, so marking them as unsupported via attributes does not provide much value.

Thanks for clarification. There are over 4500 members that throw PNSE on Browser WASM at the moment. I picked up some small portion consisting of only System.Collection-related items for this PR. If those are not supposed to be marked then I could proceed with other namespaces.

@MaximLipnin
Copy link
Contributor Author

Based on the feedback, I'm closing this PR for now.

@GrabYourPitchforks
Copy link
Member

@jkotas I agree it doesn't add much value to annotate serialization-related infrastructure. If the annotations are added by hand I'd not burn cycles adding them.

@MaximLipnin MaximLipnin deleted the system.collection_browser_unsupported branch September 7, 2020 14:11
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants