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

  • SEARCH
  • Home
  • 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 8899735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:55:49+00:00 2026-06-15T00:55:49+00:00

I have found what seems to be an anomaly in VS2012 debugger display of

  • 0

I have found what seems to be an anomaly in VS2012 debugger display of managed arrays using C++/CLI. It seems when I try to use a simple math expression for the index the debugger displays element 0 instead. See watch window below.

Watch Window

The declaration of the array looks like this.

/* Stack where the values of tokens are stored */
array<YYSTYPE>^ yyv = gcnew array<YYSTYPE> (YYMAXDEPTH);

If elements are expanded it shows for certain that the yyv[4-1] element has the same address as the yyv[0] element.

enter image description here

Is it not possible to use expressions for default indexer of managed objects in Visual Studio debugger with C++/CLI?

YYSTYPE is declared as a managed value struct containing a single Object^ reference as follows:

value struct YYSTYPE
 {
    Object^ obj;

    /* Constant integer value */
    property long int4
    {
        long get() { return safe_cast<long>(obj); }
        void set(long value) { obj = safe_cast<Object^>(value); }
    }
    /* Constant floating point value */
    property float fp
    {
        float get() { return safe_cast<float>(obj); }
        void set(float value) { obj = safe_cast<Object^>(value); }
    }

    /* Constant string */
    property String^ str
    {
        String^ get() { return safe_cast<String^>(obj); }
        void set(String^ value) { obj = safe_cast<Object^>(value); }
    }

    /* Expression or Expression Tree */
    property ExprC^ exprR
    {
        ExprC^ get() { return safe_cast<ExprC^>(obj); }
        void set(ExprC^ value) { obj = safe_cast<Object^>(value); }
    }

    /* List of expressions used for parameter lists */
    property List<ExprC^>^ exprListR
    {
        List<ExprC^>^ get() { return safe_cast<List<ExprC^>^>(obj); }
        void set(List<ExprC^>^ value) { obj = safe_cast<Object^>(value); }
    }

    /* List Of instructions */
    property InstrListC^ instrListR
    {
        InstrListC^ get() { return safe_cast<InstrListC^>(obj); }
        void set(InstrListC^ value) { obj = safe_cast<Object^>(value); }
    }

    /* Instruction with actual parameters */
    property InstrC^ instrR
    {
        InstrC^ get() { return safe_cast<InstrC^>(obj); }
        void set(InstrC^ value) { obj = safe_cast<Object^>(value); }
    }

    /* Run-time expression operator */
    property OperatorC^ operatorR
    {
        OperatorC^ get() { return safe_cast<OperatorC^>(obj); }
        void set(OperatorC^ value) { obj = safe_cast<Object^>(value); }
    }

    /* Instruction definition */
    property InstrDefC^ instrDefR
    {
        InstrDefC^ get() { return safe_cast<InstrDefC^>(obj); }
        void set(InstrDefC^ value) { obj = safe_cast<Object^>(value); }
    }

    /* Instruction definition */
    property List<String^>^ stringListR
    {
        List<String^>^ get() { return safe_cast<List<String^>^>(obj); }
        void set(List<String^>^ valueIR) { obj = safe_cast<Object^>(valueIR); }
    }
};

Added 10-18-12 16:24 PDT
I have been able to reproduce this with a much simpler C++/CLI program.

void main()
{
    array<int>^ intarray = gcnew array<int>(10);
    intarray[0]=0;
    intarray[1]=1;
    intarray[2]=2;
    intarray[3]=3;
    intarray[4]=4;
    intarray[5]=5;
}

Set breakpoint for last line then enter intarray[3] and intarray[4-1] into watch window. The [4-1] element displays 0.

  • 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-15T00:55:50+00:00Added an answer on June 15, 2026 at 12:55 am

    Today I got the following response to posting this on Microsoft Connect last month:

    Greetings from Microsoft Connect! This notification was generated for feedback item:768001

    Visual Studio 2012 debugger fails computing index of managed C++/CLI array which you submitted at the
    Microsoft Connect site. Hello Jon, Thanks for reporting this issue. We do not have a fix yet and have no current plans to fix this in the next release but will consider it for a future release. Thanks again. Marc Paine

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

Sidebar

Related Questions

I am doing some performance testing and have found that SQL seems to be
I have found that I have no problem using require to load something like
I have found that it is impossible to write ( file_put_contents or simple fwrite
I have found similar questions to mine but none of the suggestions seems to
I have found numerous partial answers to this question, but nothing that seems like
I seem to have found a weird edge case where it seems that a
I have found a CSV parsing issue with FasterCSV (1.5.0) which seems like a
I have found what seems to be an easy solution to disable certain items
If have come across an anomaly where it seems that some machines that have
I'm just starting using AFNetworking and have come across an anomaly when using enqueueBatchOfHTTPRequestOperations

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.