ユーザーの Windows ユーザー名を取得する必要がある WPF アプリケーションがあります。次のコード行を使用しています。
MessageBox.Show("Your username is:\n" + WindowsIdentity.GetCurrent().Name);
これは、私のコンピューターと他の開発者のコンピューターでは問題なく動作しますが、他の開発者のコンピューターではクラッシュします。これは権限の問題だと思います。エラーは次のとおりです。
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: notesformultipleproperties.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 51cb04a1
Problem Signature 04: PresentationFramework
Problem Signature 05: 4.0.0.0
Problem Signature 06: 504dc7da
Problem Signature 07: 7b4d
Problem Signature 08: 0
Problem Signature 09: System.Windows.Markup.XamlParse
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
ユーザーの権限に関係なく、このコード行の実行を許可できますか?