ArticleDirectory
- Download. Net 4 source code
- Prepare for debugging
- Debug code
- Review
Reason for the error in the DataGrid enumeration value update: Zhou jingen Source: blog Park release time: Read: 2287 Original article links [favorites]
OpenexpressappPreviously, the DataGrid was used as the list control. In the built-in property editing mode supported, the usage of the enumeration type was introduced. net35 is good, everything is normal, but some time ago openexpressapp was upgraded. when you edit the list control of the enumeration attribute, an error occurs. After an enumeration value is updated, the control displays an error, as shown below:
View the stack and only oneCodeAnd the rest are. net Framework internal code, read the code method, but do not understand, I think the best way is to view the code, the previous is to use reflector to view the code, but it is only static code, you can view it in vs2008. net Framework source code. Why don't I try it in vs2010? So I started to look for the net4 source code.
Download. Net 4 source code
Select. net4 download in http://referencesource.microsoft.com/netframework.aspx
Prepare for debugging
I have introduced some debugging framework code settings on the Internet. I tried it, but all of them will go to the server for download. After trying too many methods, I can perform debugging smoothly as follows:
- After installation, there are only two directories: source and symbols]
- Configure option, remove [enable just my code], and remember not to set [Enable. NET Framework source stepping] (otherwise, the PDB file will always be downloaded from the server after the permission is granted)
- Configure debug/symbols (set according to your own installation path)
- Copy the PDB to the symbols \ cache \ microsoftpublicsymbols directory. I found that the downloaded PDF file will be placed in the [microsoftpublicsymbols] Directory, so we need to copy all the PDB files in the installation path to this directory.
Debug code
- Run the code and start debugging,Remember, you can only set breakpoints through call stack.
- After step-by-step into debugging, the accident location is found
Public Class Enumconverter : Ivalueconverter { Public Object Convert ( Object Value, Type Targettype, Object Parameter, Cultureinfo Culture ){ Return New Enumviewmodel ((Enum ) Value). label ;} Public Object Convertback ( Object Value, Type Targettype, Object Parameter, Cultureinfo Culture ){ Return NULL; // This sentence is incorrect and no correct value is returned } The modification code is as follows:
Public ObjectConvertback (ObjectValue,TypeTargettype,ObjectParameter,CultureinfoCulture ){Return enumviewmodel. labeltoenum (value. tostring (), targettype );}
Review
- Multiple experiments to find the possibility
- Using. net source, you can easily debug and locate bugs.
Welcome to reprint, reprint Please note: Reprinted from Zhou jingen [http://zhoujg.cnblogs.com/]