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.