私はそれが狂っていることを知っていますが、私は予期せぬ、本当に引き金となる問題に直面しています. 起動すると、私のアプリケーション (.net 4.7 fmk の vb.net デスクトップ アプリ) は、アプリのローカル設定を含む xml ファイルを読み取ります。さて、問題は、管理者としてWindowsにログインすると、すべて問題ないことです。通常のユーザーでアクセスすると、ファイル自体が正しく読み込まれません。アプリは私にこのエラーを与えます
System.IndexOutOfRangeException(0x80131508): 位置 12 に行がありません。System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) の System.Data.DataRowCollection.get_Item(Int32 index) の Health.NET.FrmLogin.OnLoad(EventArgs e) )
XML では 12 行が実際に存在します。Windowsにログインするユーザーに関係なく、xmlファイルは同じです。2 つのさらに奇妙な影響: 1- エラーは行 12 で発生しますが、xml にその設定のゼロ値がなくても、前の行の一部が読み取られてゼロ値が返されます。2- このエラーは、30 クライアントの環境で 1 つのクライアントでのみ発生します。
基本的には、アプリケーションの名誉あるサービスの7年間で初めてのことです.
誰もこの狂気を解決する手がかりを持っていますか??
これが私が使用している生のコードです。かなり標準的なコードです
Dim ds As New DataSet
Dim Path as string = ""
path = Application.StartupPath & "\LocalConfig.xml"
ds.ReadXml(path)
' Set theme and LabelsPrinter
If Not ds.Tables.Item(0).Rows(0).Item(0).ToString = String.Empty Then
theme.Name = ds.Tables.Item(0).Rows(0).Item(0).ToString
End If
If Not ds.Tables.Item(0).Rows(2).Item(0).ToString = String.Empty Then
LocalConfig.labelsPrinterName = ds.Tables.Item(0).Rows(2).Item(0).ToString
End If
これまでのところ、すべてが正しく読み取られており、数行先でも同じですが、これに来ると:
' Set LabelsSettings
If Not ds.Tables.Item(0).Rows(7).Item(0).ToString = String.Empty Then
LocalConfig.LabelMarginTop = ds.Tables.Item(0).Rows(7).Item(0)
End If
If Not ds.Tables.Item(0).Rows(8).Item(0).ToString = String.Empty Then
LocalConfig.LabelMarginLeft = ds.Tables.Item(0).Rows(8).Item(0)
End If
THESE ARE READ BUT WITH 0 値ではなく、指定されたゼロ以外の値
If Not ds.Tables.Item(0).Rows(9).Item(0).ToString = String.Empty Then LocalConfig.UseLabelSettings = ds.Tables.Item(0).Rows(9).Item(0) End If ' Set Other Settings If Not ds.Tables.Item(0).Rows(10).Item(0).ToString = String.Empty Then LocalConfig.DefaultZoomMinutes = ds.Tables.Item(0).Rows(10).Item(0) End If If Not ds.Tables.Item(0).Rows(11).Item(0).ToString = String.Empty Then LocalConfig.DefaultKeepActualPlanningOnAddNew = ds.Tables.Item(0).Rows(11).Item(0) End If前の 3 行は正しく読み取られます
If Not ds.Tables.Item(0).Rows(12).Item(0).ToString = String.Empty Then LocalConfig.LabelPaperSizeX = ds.Tables.Item(0).Rows(12).Item(0) End If If Not ds.Tables.Item(0).Rows(13).Item(0).ToString = String.Empty Then LocalConfig.LabelPaperSizeY = ds.Tables.Item(0).Rows(13).Item(0) End If行 12 を読み取ろうとすると、実際には XML にある場合でもエラーがスローされます
繰り返しますが、管理者がログインしているので、すべて問題ありません
助けてください
編集:通常のユーザーでログインしているが、管理者権限でアプリを起動している場合、すべて正常に動作します:-O xml を含むフォルダーには、「全員」セットのフル コントロールがあります。