Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8087387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:45:36+00:00 2026-06-05T18:45:36+00:00

I asked a separate question (now deleted) for what I thought the actual problem

  • 0

I asked a separate question (now deleted) for what I thought the actual problem was.

Could the .NET Jitter not actually execute this loop:

Private Shared Sub CheckXmlValidity(ByVal textReader As System.IO.StreamReader)
  Try
    ' Check for "interesting" xml documents.
    Dim settings = New System.Xml.XmlReaderSettings()
    settings.XmlResolver = Nothing
    settings.MaxCharactersInDocument = 655360
    ' Successfully parse the file, otherwise an XmlException is to be thrown.
    Dim reader = System.Xml.XmlReader.Create(textReader, settings)
    Try
      While reader.Read()
        'Just checking.
      End While
    Finally
      reader.Close()
    End Try
  Catch ex As Exception
    Throw New HttpException(500, "Invalid Xml data", ex)
  End Try
End Sub

I would hope not exactly because of the side-effect of the exceptions that could be thrown, but I’m just checking…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:45:37+00:00Added an answer on June 5, 2026 at 6:45 pm

    The JITer, and really any optimizer, can only remove items which have no effect on the execution of the problem. Proving a method has no effect is very hard to do in .Net. Particularly because every method call can have an effect if the source object is null (it would throw an exception). Hence even methods are known to be a no-op can’t be fully removed without inserting a null check of sorts (1)

    In this case XmlReader.Read is an abstract method on an unsealed type which is even harder. The JITer could only remove this call if it knew that every implementation of XmlReader.Read was a no-op and hence had no effect. It can’t ever know this though because the number of derivations of XmlReader is not a fixed set. A new DLL could be loaded at any time with a new derivation of XmlReader which had a meaningful definition and hence couldn’t be optimized away.

    (1) Note: I’m not saying the JITer does this, just that if it removed the method it would need to do some form of null checking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have already asked this question on asp.net forum, could not find any satisfactory
This is a separate problem lingering from a previous question I asked here on
I asked this question before but the problem is I get one response and
I know this question has been asked many times, but my problem is a
I asked this question a while back but now I'm looking to implement an
I think this question is been asked for php and now I am asking
Recently I asked this question: Find Common Values in several arrays, or lists VB.NET
I asked the question about multiple rows in a previous thread, but now I
I asked a similar question just the other day, and thought I had it
I asked about pass through attributes in a different question and found I could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.