DHJJ [Hatsune's Journal Japan] blog

Hatsune's Journal Japan blog

目次

Blog 利用状況

ニュース

最新ツイート

運営サイト

Hatsune's Journal Japan
DHJJ

著作など

資格など

OCP
MCP

書庫

日記カテゴリ

わんくま同盟

痛IDE 1.4でbug

http://blogs.wankuma.com/hatsune/archive/2010/04/22/188253.aspx

VS2010RCまでは順調に動いていた痛IDE 1.4ですがVS2010RTMで動作が変わっているところがあり、そこでエラーが発生します。

痛IDE 1.4では「マイドキュメント」フォルダにItaBackground.configというファイルを作ってそこに画像ファイル名をフルパスで保存してます。

初回起動時はMicrosoft.Win32.OpenFileDialogを使って画像ファイル選択を行っているのですが、痛IDE拡張とは別スレッドとして動いてしまいエラーになるようです。

これは想像なのですが(しかもまだ解決していないのでこの想像すら外れている可能性が大きいのですが)、テキストエディタに画像ファイルの内容を表示するレイヤーを追加するMEF拡張はUIなしという状態にRTMでなっており、そのためOpenFileDialogが別スレッドで動こうとして、それに.NET Framework 4での変更点が影響して今回の事象が発生いているのではないでしょうか。

 

http://msdn.microsoft.com/ja-jp/library/ee941656.aspx

-----引用開始

Feature

Differences from 3.5 SP1

Recommended changes

Dialog boxes

To improve reliability, the CommonDialog.ShowDialog method is called on the same thread that created the Microsoft.Win32.FileDialog control.

Be sure to create a FileDialog control and call the ShowDialog method on the same thread.

-----引用終了

これって、3.5までは同じスレッドで自動的に呼ばれて、4では同じスレッドで呼ぶように自分でコードを書かないといけないってことですよね?

なお、痛StartPageの方は問題は発生しないので、痛StartPageで画像を選択してからテキストエディタウィンドウを開くことで回避は可能です。

投稿日時 : 2010年5月5日 8:07

Feedback

# re: 痛IDE 1.4でbug 2010/05/05 10:43 とっちゃん

Recommended を読む限りでは、

FileDialog を作ったスレッドでShowDialodメソッドを呼べと読めます。

その通りなら、ローカル変数として FileDialog を用意すればいいのでは?と思いますけど...

それでもだめだとするとわからんです。

# re: 痛IDE 1.4でbug 2010/05/05 12:23 はつね

それでダメなので大弱り中なのです><。

Private Function GetImageFilename(ByVal folderName As String) As String
Dim result As String = String.Empty
Dim dlg As New Microsoft.Win32.OpenFileDialog

dlg.CheckFileExists = True
dlg.InitialDirectory = folderName
dlg.FileName = "*.jpg"
dlg.DefaultExt = ".jpg"
dlg.Filter = "JPEG (.jpg)|*.jpg|PNG (.png)|*.png"
dlg.RestoreDirectory = True
dlg.Title = "Select Background image file."
dlg.Title = "テキストエディタの背景に設定する画像を選択してください。"
If dlg.ShowDialog Then
result = dlg.FileName
End If
Return result
End Function

# re: 痛IDE 1.4でbug 2010/05/05 13:05 とっちゃん

あ!
OSは。。。もしかしなくてもVer.6.x ですよね?w
だとすると、STA属性かな。
Ver.6.x のファイルダイアログは、COMなので。
古いバージョン使うフラグ立てるとうまく行けるかもしれません。

# re: 痛IDE 1.4でbug 2010/05/05 13:17 はつね

WPFから読んでいいものかどうか。。。

# ecouteur beats by dre 2012/11/17 16:09 http://www.beatsbydrepascherfrsoldes.com/

A friend which you simply find with treats shall be purchased from one.
ecouteur beats by dre http://www.beatsbydrepascherfrsoldes.com/

# Pull Lacoste 2012/11/25 18:32 http://www.fr-marque.com/

A friend you simply acquire together with creates can be bought from we.
Pull Lacoste http://www.fr-marque.com/

# casquette ny 2013/03/14 7:29 http://www.a44.fr/

To everyone you could be yourself, and yet to at least one someone you could be on earth. casquette ny http://www.a44.fr/

# casquette chicago bulls 2013/03/15 20:56 http://www.a77.fr/

If you need a strong bookkeeping of these really worth, amount the children. casquette chicago bulls http://www.a77.fr/

# Shoes.fr 2013/03/16 15:59 http://www.c88.fr/

Camaraderie could be the Coptis trifolia groenlandica the neckties these spirits epidermis arena. Shoes.fr http://www.c88.fr/

タイトル
名前
Url
コメント