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 3594994
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:47:33+00:00 2026-05-18T19:47:33+00:00

I have encountered strange issue with lists in F#. I am using XamlXmlReader to

  • 0

I have encountered strange issue with lists in F#.
I am using XamlXmlReader to generate list and sequence like:

let xaml_reader = XamlXmlReader(filename)
let nodes_seqs = seq { while xaml_reader.Read() do yield xaml_reader }

This code is working perfectly but if I do the same with list:

let xaml_reader2 = XamlXmlReader(filename)
let nodes_list = [ while xaml_reader2.Read() do yield xaml_reader2 ]

The result list is not correct i.e. head element of the sequence contains correct NodeType, LinePosition, LineNumber etc but head element of the list is kind of garbage with pointing to another place in XAML. Example:

let head_of_seq = Seq.head nodes_seq
let head_of_list = List.head nodes_list

After I have:

  • head_of_seq.NodeType = NamespaceDeclaration
  • head_of_seq.LineNumber = 2
  • head_of_seq.LinePosition = 2

But:

  • head_of_list.NodeType = None
  • head_of_list.LineNumber = 111
  • head_of_list.LinePosition = 30

XAML file itself is correct and generated by Microsoft Bend. Any clues? I’ll appreciate any help.

  • 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-05-18T19:47:34+00:00Added an answer on May 18, 2026 at 7:47 pm

    Why are you yielding the XamlXmlReader itself from within your sequence or list? That is, shouldn’t you be using yield xaml_reader.Value instead?

    In either case, you just end up with a sequence (or list) containing the same XamlXmlReader instance many times. When you iterate over the sequence once, it will appear to be correct, since the reader is being advanced once as each element is read. However, even your sequence is almost certainly not doing what you think. For instance, what happens if you try this?

    let first = Seq.head nodes_seqs
    let first2 = Seq.head nodes_seqs
    

    Because the XamlXmlReader is being advanced each time the sequence is accessed, first2 will appear to be pointing at the second element (and looking at first after first2 has been evaluated will show the same thing).

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

Sidebar

Related Questions

I have encountered odd behavior when using document.getElementById tonight. Duplicated in Firefox 3 and
So far I have encountered adjacency list, nested sets and nested intervals as models
I am using ajaxForm. Now I have encountered a problem. My idea is when
I have encountered a rather odd error that I do not understand. I created
I have encountered a problem that I have not come accross yet when setting
My coworker and I have encountered a nasty situation where we have to use
I am debugging some code and have encountered the following SQL query (simplified version):
I am moving from classic ASP to ASP.NET and have encountered what many of
I'm migrating a TSQL stored procedure to PL/SQL and have encountered a problem -
We are considering a move from SVN to Mercurial, and have encountered a stumbling

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.