-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 "new NotImplementedExceptions" from corefx assemblies. #22069
Comments
@davidsh some of these are networking. @atsushikan looks like already filtered out those that are of the form I made the list into checkboxes but it seems to have iffy formatting. |
@atsushikan I do'nt think there is anything particular to UWP here. Although we should do this pass, I'm going to move out of that milestone as I don't think it's required to ship it. Tests should catch anything UWP specific. Let me know if I'm wrong. |
@danmoseley Is this issue still relevant? (4 years after👀). I found about 200
I found some cases where whole class is not abstract (for example |
Hmm. Many do seem to be cases where I am not sure whether that is worth changing (which would be a breaking change, albeit a relatively low risk one presumably). I think the original goal of the opener here was to make it possible to grep for @jkotas how do you feel about this goal? |
I do not have a strong opinion about this. Here are some statistics about patterns used under src/libraries:
So we are close to break-even between NotImplemetedException and NotSupportedException.
|
My feeling is that it is not worth making a push here and we should encourage contributors to look at other issues. |
I agree with both comments above, so closing this issue for now. Feel free to re-open if you think this is an issue that should be addressed. |
Sites found by tooling:
System.Net.HttpListener.DisconnectAsyncResult::AsyncState.get()
System.Net.HttpListener.DisconnectAsyncResult::AsyncWaitHandle.get()
System.Net.HttpListener.DisconnectAsyncResult::CompletedSynchronously.get()
System.Net.HttpListener.DisconnectAsyncResult::IsCompleted.get()
System.Net.WebSockets.HttpListenerWebSocketContext::CopyPrincipal(IPrincipal)
System.Net.WebSockets.WebSocketBase.WebSocketOperation::ProcessAction_IndicateReceiveComplete (Nullable<ArraySegment>, BufferType, Action, Buffer[], uint, IntPtr)
System.Net.Mime.EightBitStream::DecodeBytes(byte[], int, int)
System.Net.Mime.EightBitStream::EncodeBytes(byte[], int, int)
System.Net.Mime.EightBitStream::GetEncodedString()
System.Net.Mime.MimeBasePart::BeginSend(BaseWriter, AsyncCallback, bool, object)
System.Net.Mime.MimeBasePart::Send(BaseWriter, bool)
System.Runtime.Serialization.Json.ReflectionJsonReader::ReadSimpleDictionary(XmlReaderDelegator, XmlObjectSerializerReadContext, CollectionDataContract, Type, object)
System.Runtime.Serialization.NullPrimitiveDataContract::ReadMethodName.get()
System.Runtime.Serialization.NullPrimitiveDataContract::ReadXmlValue(XmlReaderDelegator, XmlObjectSerializerReadContext)
System.Runtime.Serialization.NullPrimitiveDataContract::WriteMethodName.get()
System.Runtime.Serialization.NullPrimitiveDataContract::WriteXmlElement(XmlWriterDelegator, object, XmlObjectSerializerWriteContext, XmlDictionaryString, XmlDictionaryString)
System.Runtime.Serialization.NullPrimitiveDataContract::WriteXmlValue(XmlWriterDelegator, object, XmlObjectSerializerWriteContext)
System.Runtime.Serialization.XmlDataContract::ReflectionCreateXmlSerializable(Type)
System.Runtime.Serialization.XmlObjectSerializerReadContext::IsBitSet(byte[], int)
System.ServiceModel.Channels.StreamConnection::GetCoreTransport()
System.ServiceModel.Dispatcher.DispatchRuntime.UnhandledActionInvoker::InvokeBegin(object, object[], AsyncCallback, object)
System.ServiceModel.Dispatcher.DispatchRuntime.UnhandledActionInvoker::InvokeEnd(object, object[], IAsyncResult)
MS.Internal.Xml.Cache.XPathDocumentBuilder::WriteEntityRef(string)
System.Xml.Serialization.ReflectionXmlSerializationReader::WriteArray(ArrayMapping, bool, bool, string, int, Fixup, Member)
System.Xml.Serialization.ReflectionXmlSerializationReader::WriteAttribute(Member, object)
System.Xml.Serialization.ReflectionXmlSerializationReader::WriteElement(ElementAccessor, bool, bool, bool, string, int, int, Fixup, Member)
System.Xml.Serialization.ReflectionXmlSerializationReader::WriteLiteralStructMethod(StructMapping, bool, bool, string)
System.Xml.Serialization.XmlSerializer::CreateReader()
System.Xml.Serialization.XmlSerializer::CreateWriter()
System.Xml.Serialization.XmlSerializer::Deserialize(XmlSerializationReader)
System.Xml.Serialization.XmlSerializer::Serialize(object, XmlSerializationWriter)
System.Xml.XmlRawWriter::WriteEndElementAsync(string, string, string)
System.Xml.XmlRawWriter::WriteNamespaceDeclarationAsync(string, string)
System.Xml.XmlReader::GetValueAsync()
System.Xml.XmlReader::ReadAsync()
System.Xml.XmlResolver::GetEntityAsync(Uri, string, Type)
System.Xml.XmlTextWriterBase64Encoder::WriteCharsAsync(char[], int, int)
System.Xml.XmlWellFormedWriter.NamespaceResolverProxy::System.Xml.IXmlNamespaceResolver.GetNamespacesInScope(XmlNamespaceScope)
System.Xml.XmlWriter::FlushAsync()
System.Xml.XmlWriter::WriteBase64Async(byte[], int, int)
System.Xml.XmlWriter::WriteCDataAsync(string)
System.Xml.XmlWriter::WriteCharEntityAsync(char)
System.Xml.XmlWriter::WriteCharsAsync(char[], int, int)
System.Xml.XmlWriter::WriteCommentAsync(string)
System.Xml.XmlWriter::WriteDocTypeAsync(string, string, string, string)
System.Xml.XmlWriter::WriteEndAttributeAsync()
System.Xml.XmlWriter::WriteEndDocumentAsync()
System.Xml.XmlWriter::WriteEndElementAsync()
System.Xml.XmlWriter::WriteEntityRefAsync(string)
System.Xml.XmlWriter::WriteFullEndElementAsync()
System.Xml.XmlWriter::WriteProcessingInstructionAsync(string, string)
System.Xml.XmlWriter::WriteRawAsync(char[], int, int)
System.Xml.XmlWriter::WriteRawAsync(string)
System.Xml.XmlWriter::WriteStartAttributeAsync(string, string, string)
System.Xml.XmlWriter::WriteStartDocumentAsync()
System.Xml.XmlWriter::WriteStartDocumentAsync(bool)
System.Xml.XmlWriter::WriteStartElementAsync(string, string, string)
System.Xml.XmlWriter::WriteStringAsync(string)
System.Xml.XmlWriter::WriteSurrogateCharEntityAsync(char, char)
System.Xml.XmlWriter::WriteWhitespaceAsync(string)
System.Xml.Xsl.XsltOld.ContainerAction::Compile(Compiler)
System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeBuffer::EnsureHasMarshalProxy()
System.Security.Cryptography.DSA::DerivedClassMustOverride()
System.Security.Cryptography.ECDiffieHellmanPublicKey::ToXmlString()
System.Security.Cryptography.ECDsa::FromXmlString(string)
System.Security.Cryptography.ECDsa::ToXmlString(bool)
System.Security.Cryptography.RandomNumberGenerator::GetNonZeroBytes(byte[])
System.Security.Cryptography.RSA::DerivedClassMustOverride()
System.Security.Cryptography.AsymmetricAlgorithm::FromXmlString(string)
System.Security.Cryptography.AsymmetricAlgorithm::KeyExchangeAlgorithm.get()
System.Security.Cryptography.AsymmetricAlgorithm::SignatureAlgorithm.get()
System.Security.Cryptography.AsymmetricAlgorithm::ToXmlString(bool)
System.Transactions.InternalEnlistment::PromotableSinglePhaseNotification.get()
System.Transactions.InternalEnlistment::ResourceManagerIdentifier.get()
How to remove:
Options for removing “throw new NotImplementedException()”:
If you can implement the missing functionality now:
Do so.
If this is functionality that’s not supported on a particular framework or OS, replace with
throw new PlatformNotSupportedException(SR.xxx);
If this is an api that needs to throw NotImplemented for backward compat reasons, replace with:
throw NotImplemented.ByDesign;
or
throw NotImplemented.ByDesignWithMessage(SR.xxx);
If this is a virtual api method that’s only intended to work when overridden by another class, replace with:
throw new NotSupportedException(SR.xxx);
(Unless required for backward compat, refrain from throwing NotImplemented out of these.)
If this is a virtual non-api method that’s only intended to work when overridden by another class, replace with:
An abstract method.
If this is a compiler or toolchain intrinsic that only needs a body to make C# happy:
throw new NotSupportedException();
If this is true undone work and you just can’t fix it now, replace with:
throw NotImplemented.ActiveIssue(“https://github.com/dotnet/corefx/issues/xxx”);
The string will not leak out via Exception.Message. The string is for tooling and human readers only. In the past, we’ve usually added an inline comment but the trouble with those is that IL-based tooling can’t read comments.
The text was updated successfully, but these errors were encountered: