Search
Closed
as Fixed Help for as Fixed

0
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Suggestion
ID: 463506
Opened: 6/2/2009 10:33:50 PM
Access Restriction: Public
0
Workaround(s)
IDEが誤ったエラーを表示する。
メッセージは「負のサイズで配列を作成することはできません。」です。

// C# サンプルコード

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int sum = class1.GetSum();
            Console.WriteLine("sum = {0}", sum);
        }

        static class class1
        {
            internal static int GetSum()
            {
                // 負のサイズで配列を作成することはできません。
                int[] array = new int[ARRAY_SIZE - 1];
                for (int i = 0; i < array.Length; i++)
                {
                    array[i] = i;
                }
                return array.Sum();    
            }

            const int ARRAY_SIZE = 11;
        }
    }
}
Details (expand)
製品言語
日本語
バージョン
Visual Studio 2008 SP1
オペレーティング システム
Windows Vista
オペレーティング システム言語
日本語
現状の問題点
C#コンパイラもしくはVS2008のバグだと思います。
問題解決のための提案
C#コンパイラもしくはVS2008のバグを修正する。
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 6/3/2009 at 6:45 PM

この度は、フィードバックをお送りいただき、誠にありがとうございます。 現在、お送りいただきました報告内容に基づき問題を調査中ですので、しばらくお待ちください。 よろしくお願いいたします。

[Problem Description]
The Visual Studio 2008 IDE displays an incorrect error, “Cannot create an array with a negative size.”

// C# sample code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int sum = class1.GetSum();
            Console.WriteLine("sum = {0}", sum);
        }

        static class class1
        {
            internal static int GetSum()
            {
                // Cannot create an array with a negative size.
                int[] array = new int[ARRAY_SIZE - 1];
                for (int i = 0; i < array.Length; i++)
                {
                    array[i] = i;
                }
                return array.Sum();
            }

            const int ARRAY_SIZE = 11;
        }
    }
}

[Problem Statement]
This seems like a bug of the C# compiler or Visual Studio 2008.

[Proposed Solution]
Please fix the bug.

Posted by Microsoft on 6/4/2009 at 4:59 AM
Thank you for your feedback, we are currently reviewing the feedback you have submitted.
Posted by Microsoft on 6/4/2009 at 5:31 PM

(こちらは、[投稿者: Microsoft、投稿日時: 2009/06/04 4:59] の和訳です。)

フィードバックをお寄せいただき、ありがとうございます。 MicroVAX さんからご投稿いただきましたフィードバックに関しまして、私たちは現在調査しております。

Posted by Microsoft on 6/4/2009 at 5:55 PM
Hi MicroVAX,

Thank you for reporting this issue to us.
I can reproduce your squiggle error on VS2008 SP1 but this no longer reproduces in VS2010 Beta release which mean this issue has been fixed.

Please let me know if there is anything else I can help you with and thanks alot for using Visual Studio.

Frances Lam
C# Compiler Test Lead
Posted by Microsoft on 6/4/2009 at 6:25 PM

(こちらは、[投稿者: Microsoft、投稿日時: 2009/06/04 17:55] の和訳です。)

MicroVAX さん、こんにちは。

問題をご報告いただき、ありがとうございます。 ご報告いただきました squiggle エラー (訳注: 波下線が引かれるエラー) に関しまして、私の方で確認しましたところ、Visual Studio 2008 SP1 では再現しましたが、Visual Studio 2010 ベータ リリース版では再現しなかったため、この問題は修正されていると考えられます。

他にも何か私がお役に立てることがありましたら、ご連絡ください。 Visual Studio をご利用いただき、誠にありがとうございます。

Frances Lam
C# コンパイラ テスト リード