0

だから私はしばらくこれについて頭を悩ませてきましたが、それを理解することはできません. どこでハングアップしているかを確認するためにいくつかのデバッグ手順を実行しましたが、Visual Studio からは何も得られません。基本的に、配列と現在の画像への現在のインデックスを追跡する配列を持つクラスがあります。

ただし、デバッグ中 (またはデバッグしていないとき) は、"index" の値に関係なく、"currentLocation" は更新されません。問題が何であるかを理解できないようです。助言がありますか?

public class TestClass : INotifyPropertyChanged
{
    //...

    public void GoTo(int index)
    {
        if (index == currentLocation)
            return;
        else if (index >= data.Length)
            this.currentLocation = data.Length - 1;
        else if (index <= 0)
            this.currentLocation = 0;
        else
            this.currentLocation = index;

        //this is where the debugging drops off
    }

    //doesn't matter if I initialize the value or not
    //private int _currentLocation = 0;
    private int _currentLocation;
    public int currentLocation
    {
        get { return _currentLocation; }
        set 
        { 
            //never hits this line
            this.SetProperty(ref this._currentLocation, value); 
            //more work 
        }
    }
    //...
}
4

1 に答える 1

2

コメントの回答によると、セッターにブレークポイントがなく、F11 (ステップイン) を使用してそこに到達しようとしていることがわかります。対応するデバッガー設定を無効にするまで機能しません。[ツール] → [オプション] → [デバッグ] を開きます。オプション「プロパティと演算子のステップオーバー」(デフォルトで有効になっている必要があります)を見つけて無効にします。または、より便利な場合は、セッターにブレークポイントを設定します。

于 2013-10-25T22:17:33.400 に答える