11.14.2005

Remoting and Generic

這兩天試了試Remoting,發現之前有關於Generic的部份要加以修改,我想他是可以使用的,然而卻有部分的限制。

這兩天都在試動態Load Assembly,然後掛到Service上面,是的,可以做,也運作的非常好。不過之前測試的版本卻不行,這兩天,我想要找出來哪裡有錯。

另外有關於Remote Object的解構式,他比較特別的是,Server端的GC並不會去呼叫。

我本來的想法是把一個Singleton Remote Object當作一個Cache,在Constructor時讀取資料庫,然後所以的資料變動都放在他身上,然後當Client沒有動作超過五分鐘(Singleton Object Default Life Time),會呼叫解構式,那時候再寫進Database,不過,測試的結果似乎是GC並不會去Run這一段,Remote Object就直接消滅了。

修改:有關上面這一段,我有再做一個測試,就是在解構式裡面寫檔案,當然,當五分鐘過後再開一個新的Client去呼叫,會起一個新的Remote Object, 但是當Remote Service Close掉時,卻會呼叫這個Remote Object的解構式。所以上面那一段的說法有問題,應該是說GC會去處理,但是處理後並不一定會馬上消滅這個物件,消滅這個物件的準確時間看來部是我們可以知道的,所以不管怎麼說,把寫入資料庫的動作放在解構式看來很不智,呵呵。

這兩天要測試當List 或是 SortedList 包含可序列化的 Complex Object,是否可以使用在Remoting上面。

還有就是兩個版本的Load Assembly,為啥一個能跑,另一個不能跑。

--------------------------------------------------------------------

Here are practice for English writing, welcome any comment for grammar or tech.

I had test Remoting and Generic this week, and find out the way to run, there are some limited when using generic in remoting. So…the posted article is wrong.

I also test the way to dynamically load assembly and plug into remoting service. Indeed, It's work, the better thing is so smooth. I need to find the difference between the versions, because I spent a lot to turn the first version and cannot run till.

Beside that, I find the special thing about destructor of remote object. The special thing is that GC in the server side would not to call destructor when the object disposed.

The original blueprint of my idea is using singleton remote object as cache for some usual table in database. The remote object load data from database in constructor and whole change are imply in the object. Than, when five mins gone and no client call it, the object would to write data into database in destructor (the default life time for singleton object are five mins without any client call). But the result of this test is that seems GC would not call the object's destructor and dispose it directly.

Fix: I run another test after post this. The test is put an write file code in the remote object's destructor and wait the lift time. After five mins pass and I run a new client to call the remote object, the data show the object is new because the data had input was gone. But the write file code run in the time I close the service. The conclusion is the GC in server side would mark the disposed object but do not clear it immediately, the time point would be control by GC and we had no way to know. Whatever, put the code that write change into database into destructor is silly, ha.

Ok, next week I would test that is remoting could run with the generic container that contain the complex object. And the version difference.

11.02.2005

Package Load Failure - RecipeManagerPackage

這個問題自從安裝了VSTS RC(Release Candidate)版就會發生,當安裝完一打開,就會跳出像圖片的這個錯誤訊息,選Yes,以後就不會出現,選No...他就會一直煩你。

因為最近很忙,所以這兩天Visual Studio 2005 Final 出來了,uninstall VSTS RC後,再安裝VS 2005 Final. 又還是有這個錯。

很忙是因為公司裡要生個東西出來,Push的很兇。不過呢,你也知道,眾人之事,就是只要有一兩很扯的人,就會搞的整團亂。

今天才跑上去Feedback去查了查...唉

事情是這樣的,當你一打開Visaul Studio 2005,你會發現跳出一個錯誤,就是說沒辦法把"'Microsoft.Practices.RecipeFramework.VisualStudio.RecipeManagerPackage"這個東西Load上去之類的。

Feedback裡面的相關Post(都是Package Load Failure),我依照時間列在下面英文版裡面,看來問題未解決,不過呢,個人是比較希望能有個說明啦,因為不知道那是啥東西,也不給Fix...這很難令人心安

-----------------------------------------------------------------------------------------

Here are writting practice for English, welcome the comment for grammar.

The error message would happen after install VSTS RC(Visual Studio Team System Release Candicate). The error message as the picture would popup when you open IDE, choice Yes, then would not show again, else, it would be popup again and again.

I didnt try to fix it because busy. So, after Visual Studio 2205 released, I do uninstall VSTS RC and install Visual Studio 2005, the error still happen.

Because my division are doing all we can do in a new web application hardly. but, You know that, there are only need one or two special guy, the team work would be fall into marsh.

so...I check it today

The exact description is there are failure to load "'Microsoft.Practices.RecipeFramework.VisualStudio.RecipeManagerPackage" or something like this when you open Visual Studio or open(include create) the project.

Listed below is the relative post in feedback center, there are order by time.

Seems the problem do not resolve till.But, I thought that would be better to explain what is the package before the fix.

Package Load Failure
Opened Date: 2005-04-12 07:22:50 http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=af9f4001-b8b9-4990-bf42-3a016f5a5fa0

Load failure
Opened Date: 2005-04-19 09:35:24 http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=d4123792-a7fd-463f-9bba-01826edaa805

Package Load Failure for Package "...VSDesignPackage"
Opened Date: 2004-07-23 08:11:13 http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=3640d6a6-c789-4890-91f6-804cc2c81eb6

Package Load Failure - Release Candidate
Opened Date: 2005-10-06 14:54:04 http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=ba5d9e57-6aaa-4349-a1e5-7ea49408101a

Package Load Failure in RTM build 50727.26
Opened Date: 2005-10-24 07:23:01 http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=d6568c6c-2b79-416b-939f-a6f39eafa20b Posted by Picasa

11.01.2005

The Links For Pre Post

當在反序列化時會有BinaryFormatter失敗http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=b08b64df-49f2-44a3-ac10-7811281eb149

請注意最後三個Post。

特別是"Resolved as Postponed by Microsoft on 2005-09-26 at 13:02:38 "這一個。

下面是另一個類似的Feedback

BinaryFormatter.AssemblyFormat似乎沒有功能
http://lab.msdn.microsoft.com/productfeedback/ViewFeedback.aspx?FeedbackID=c2045aff-b884-4052-bbfe-3c8c87361396

最後是這個

錯誤訊息=BadImageFormatException:Not to possible to perform a call with reflection on a generic method on a .NET remoting transparent proxy
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=059c20b0-f9b5-4982-a822-9c41fcc5efdf

以上我沒去找相對映的中文錯誤訊息,有翻的都是按自己的意思翻,看英文比較準

----------------------------------------------------------------

Here are writting practice verion, welcome for comment.

BinaryFormatter fails to deserialize
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=b08b64df-49f2-44a3-ac10-7811281eb149

Please Focus on Last Tree Comments.

Especially "Resolved as Postponed by Microsoft on 2005-09-26 at 13:02:38 "

And Here Is The Other Feedback

setting BinaryFormatter.AssemblyFormat to Simple has no effect.
http://lab.msdn.microsoft.com/productfeedback/ViewFeedback.aspx?FeedbackID=c2045aff-b884-4052-bbfe-3c8c87361396

And Finally Is This Feedback

BadImageFormatException: Not to possible to perform a call with reflection on a generic method on a .NET remoting transparent proxy
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=059c20b0-f9b5-4982-a822-9c41fcc5efdf

Above-mention in Chinese are not sure accurate error message in Visual Studio 2005 CHT version, there are traslated by myself.

So, You can look English version for accurate error message.

Generic and Remoting...Sorry, u are not the couple

前一陣子,拿到Visual Studio 2005 Beta2,看到Generic...這麼熟悉的工具,就拿起來給他用了下去。

我的Case是Remoting,所以尬下去,寫的很爽,也沒做Prototype,想說之前的都OK!

過了兩天,Business Layer寫好了,UI先寫了一隻,掛了上去,一試....OH, MY GOD!

上去Feedback Center翻了翻,發現Generic確定無法使用在XML Serialization上,隱含的意思就是Remoting跟Web Service無法使用Generic.

嗯,心裡有一個小小的聲音,"為甚麼會做一半呢?"...當看完那兩篇Feedback後。

當然啦! 身為Microsoft MVP...這個聲音的音量是很小的.....唉

下面是練習英文版,再下一篇會是對這個Topic的一些看法。

-----------------------------------------------------------------------

Here are the version for English, the practice for my poor English...

the comment for English is welcome, about tech, that is the same.

I got the beta 2 of visual studio 2005, and saw a article about Generic...Before .NET C#, I am using C++ for a long time.

So...what a wonderful tool that I had ever knew. no matter call it as Template or Generic.

I put it into my new case, The case is using Remoting for communication. I thought that would be OK and without write a new prototype for test, because I run a couple cases using the prepared prototype.

The only difference is that, Generic...

After I finished Business Layer, and wrote a UI Form to test...BOMMMM! Oh! My God! That cant run...

I check in the MSDN Feedback Center and find the fact...Generic can't run in XML Serialization, the implicate is Remoting and Web Service can't use Generic class for communication.

Oh! there are a small voice inside my mind " Why, Why do it unfinished!" after read the two feedback.

Of couse! The voice is very small........Ha!

The next post would be discuss about the topic.

10.29.2005

2.0.50727

之前,在Seattle的Global Suimmit拿到VSTS的RC版,就給他Try下去,把一個Case翻成2.0,想說應該不會差太多,沒想到VS2005一出來,仔細一看,.Net Framework 2.0居然不一樣,RC是2.0.50727.26,Final是2.0.50727.42,剎那間,OOXX不少。
為甚麼VSTS RC不能等到.Net Framwork 2.0 Final呢? 希望他能出RC2。

害我又要重灌Visual Studio 2005,然後Retest一番。

另外還有一個關於Remoting的該死的Bug. 先賣個關子,等確定再公佈。

I got the VSTS RC from MVP global summit in seattle, and try in one of my case. I thought, RC should be use the final version of .Net framework 2.0. But, I am wrong, I am very OOXX when I g download the .Net fromework 2.0 from MSDN, because the version of final is 2.0.50727.42, and the version in VSTS RC is 2.0.50727.42.
Why, Why the VSTS RC do not use the final version of .Net framework? I hope that would have VSTS RC2 that issue by final version.
I need to reinstall visual studio 2005, and reconfirm my case.
There are also has a bug about Remoting, I would post it when I confirm that.

7.20.2005

有關Enterprise Library 1.1

影響到全部Block的有:
  1. 在一月份的版本的Configuration Application Block,會有一個memory leak的問題,它會影響到所有的Block. 新版本修正了這個問題。 在這之前,Enterprise Library 也釋出了Patch 1475 修正它。不過Patch 1475 現在要加入Member 才能拿的到,要的話,請Email給我(下載的資訊有錯,請不吝指正)。
  2. 新版本 在Configuration Application Block 讀取設定的部份做了一個加速的最佳化。
  3. 新版本 使用CultureInfo.CurrentUICulture來傳回資源字串(string resources),在Runtime時可透過Resource Manager來完成多國語系
  4. 新版本的所有 Assembly 的版本號碼都做了更新,所以一月份(1.0)與六月份(1.1)可以用並行存在,執行(side-by-side)。 但是兩個版本間的Block不能混用。

雜項

  1. 新版的Enterprise Library出來了,1.1版,給.Net 2.0的部份也在做了。Enterprise Library的網址變了,新網址在此 Enterprise Library
  2. 昨天上Global Chat,VSTS會整合FxCop。對於Test的部份,看了那些討論,深深覺得,會不會只要會用nUnit的人,就已經算是1%的人才了。
  3. 相對應於VSTS,James Newkirk的速度真的很快,NUnit Converter 0.4已經跑出來了,Currently it contains a program that converts NUnit Test Code into tests compatible with Visual Studio 2005 Team System。有興趣的可以去看一看。

2.23.2005

有關Custom Control,Windows Form

很多時候,事情並不是我這樣的笨人所想像的。搞了半天,慢慢的才搞清楚整個架構。

其實在MSDN裡面就已經清清楚楚的告訴我們了,怎麼去運作出個完全由自己操作的Control,只是,文件看來不是我這樣的笨人所看的懂得,哈哈。

要訂製一個照自己想法產生的控制項的話,在MSDN Home > MSDN Library > .NET Development > .NET Framework SDK > .NET Framework > Building Applications > Enhancing Design-Time Support 裡面幾乎就有大部分相關訊息。

不過,很多時候,MSDN的難度超越了我這樣Concrete腦,所以下面還有一些相關的文件,這些,就好用多了:

故事是在之前不冷颼颼,反而熱的要死的冬天開始的...

那一天,依稀記得,客戶要求能夠多語系來操作軟體,因為客戶裡有不太認識中文的台灣人。

於是就開始寫,寫阿寫阿,突然發現Microsoft綁在Visual Studio .Net的多語功能有點鳥。或許是我孤陋寡聞,不過怎麼想也不對。為甚麼如果我選擇在Windows Form下寫的程式要套用Visual Studio.Net 的控制項多語功能,就不能再混入資源檔。那那,我的訊息對話窗怎麼辦?要秀在狀態列或是標題的文字怎麼辦,那些是會變化的耶!

雖然發現這樣的事情,對一個工程師是新知識的累積,不過,當壓力來的時候,就像要挫屎的時候才發現鬆緊褲的帶子打了死結。怎麼辦呢?怎麼辦呢?就開始想一些偏門的方法,後來,就想到做一個控制項,將所有相關文字鎖到那裡面,因為控制項變動的時候,文字一樣受到Visual Studio .Net的多語規範,哈哈哈。

當弄出來的時候,自己還沾沾自喜,後來才發現脫了褲子放屁還覺得了不起的一定只能幹基層工程師,這是不會錯的。


一邊作一邊學,慢慢的,終於發現自己完全搞不清楚狀況,Visual Studio .Net的多語規範根本不在控制項上,而是在Attribute的運用上,繞了一圈,還好發現了對的東西,順便碰了一堆雜七雜八的東西,心得,就是一開始的介紹那麼簡單。


不過,有些神奇的事情,還是搞不懂


我知道怎麼用StringCollectionEditor,但是怎麼發現的ㄚ?


恩,應該用ILdasm了!

2.02.2005

有關ADO.Net裡的類別

對於.Net Framework所提供的Class,我們可以大概的說,DataSet是小型的資料庫,可以把它想做是一個倉庫,而DataTable,DataView是其中的單元(這一部份可對應到資料庫)。
而DataReader可以把它想做是倉庫的監視器,可以一整排一整排的查詢資料。
DataCommand則可想做倉庫的經理,一切命令的發布來自於它,可以新增貨物,更新貨物,或是刪除貨物。
DataAdaptor則想像為與其他倉庫的連接器,可以連通兩個倉庫,以便取得資料(貨物)。