Code Monkey home page Code Monkey logo

Comments (6)

krwq avatar krwq commented on June 13, 2024 2

@mairaw I believe the comment is correct.

@ChrisMaddock here is an example:

string xml = @"<?xml version=""1.0""?><foo>bar</foo>";
var doc = new XmlDocument();
doc.LoadXml(xml);
var node = doc.FirstChild;
XmlNodeList test = node.SelectNodes("//*");
Console.WriteLine(test == null); // prints True

from dotnet-api-docs.

pjanotti avatar pjanotti commented on June 13, 2024 1

@mairaw I think what people care about are the types listed in the comment but to be technically correct it should be that it returns null if CreateNavigator for the XmlNode returns null.

from dotnet-api-docs.

mairaw avatar mairaw commented on June 13, 2024

@ChrisMaddock that is odd, since we generate the IntelliSense from the docs.
Can you share what you're seeing on IntelliSense and what kind of project you have?

But it seems that SelectNodes can actually return null:
https://referencesource.microsoft.com/#System.Xml/System/Xml/Dom/XmlNode.cs,67
https://github.com/dotnet/corefx/blob/master/src/System.Private.Xml/src/System/Xml/Dom/XmlNode.cs#L71

@krwq, @pjanotti should we just document what's on the comments?

from dotnet-api-docs.

ChrisMaddock avatar ChrisMaddock commented on June 13, 2024

@mairaw - Apologies, I was wrong about the source - the hint seems to be generated by ReSharper rather than Intellisense. I wonder what ReSharper derives that information from, in that case...

image

For the record - the project is the NUnit console - a .NET Framework 2.0 console application.

from dotnet-api-docs.

mairaw avatar mairaw commented on June 13, 2024

No worries @ChrisMaddock. Thanks for letting me know the source. Not sure how ReSharper is implemented. Maybe it looks at the implementation and checks for null returns?

But we'll add the info to the docs too. Just don't know when yet.

from dotnet-api-docs.

pjanotti avatar pjanotti commented on June 13, 2024

IIRC ReSharper has a way to decorate stuff inside assemblies for which you don't build from sources, these attributes then are read and used at analysis time. So they can add stuff to indicate that specific things never return null, etc. I don't have any idea about what they used as a start point but by now they have accumulated a good deal of knowledge about this type of issue.

from dotnet-api-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.