涉及到自动编译的时候,比如使用XmlSerializer Xml的序列化和反序列化或codeDom的自动编译的方法(CompileAssemblyFromBatch()等)使用的时候,会启动C#的编译器csc.exe, 由于在亚洲版的win xp操作系统中,特有的ConIme.exe,所以csc内部中有启动ConIme的功能,为了其支持输入如汉字,和日本语,韩国语的字符。但是启动过程中会有ConIme启动失败的时候,此处原因未明(ms也没有个说法),会在此处等上10分钟,然后csc才会接到timeout的异常而返回。
根据ms的说法,解决方法是,一个是不用csc如果xml序列化的时候,可以不用call csc.exe but 如果真的要自动编译一个C#文件,那就逃也逃不掉csc了。这时候要做的就是屏蔽ConIme,不让其启动,这样csc就可以摆脱那个万一的10分钟的deadLock了。
大致代码如下:
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](/Images/OutliningIndicators/InBlock.gif)
4
![](/Images/OutliningIndicators/InBlock.gif)
5
![](/Images/OutliningIndicators/InBlock.gif)
6
![](/Images/OutliningIndicators/InBlock.gif)
7
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
8
![](/Images/OutliningIndicators/InBlock.gif)
9
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
10
![](/Images/OutliningIndicators/InBlock.gif)
11
![](/Images/OutliningIndicators/InBlock.gif)
12
![](/Images/OutliningIndicators/InBlock.gif)
13
![](/Images/OutliningIndicators/InBlock.gif)
14
![](/Images/OutliningIndicators/InBlock.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
18
![](/Images/OutliningIndicators/None.gif)
19
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
22
![](/Images/OutliningIndicators/None.gif)
23
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
24
![](/Images/OutliningIndicators/InBlock.gif)
25
![](/Images/OutliningIndicators/InBlock.gif)
26
![](/Images/OutliningIndicators/InBlock.gif)
27
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
28
![](/Images/OutliningIndicators/InBlock.gif)
29
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
30
![](/Images/OutliningIndicators/InBlock.gif)
31
![](/Images/OutliningIndicators/InBlock.gif)
32
![](/Images/OutliningIndicators/InBlock.gif)
33
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
代码简单说明如下:
1.opensubkey("Console",true)的第二个参数要是真,否则不能修改其keyvalue.
2.修改了keyvalue后,要close()这样才能有效。总开着也觉得不舒服吧?
3.要finally中恢复你修改的keyvalue.这是因为将loadConIme的value改为0之后,再Cmd Console中中文输入法等亚洲系列的ConIme将无法启动,所以只在你需要的时候屏蔽一下,用完了总是要还的。(出来混总是要还的。)