Thursday, September 30, 2010
Visual Studio Keyboard Shortcuts
Expand Region Under Cursor: CTL + M, CTL + O
Toggle Region Under Cursor: CTL + M, CTL + M
Monday, September 13, 2010
BinaryFormatter & “Invalid number of fixups”
While working with clsClaim (which inherits from clsGenericCollection(Of clsNCPDP)) on the Billing Screen, I was receiving the following error when deserializing:
The ObjectManager found an invalid number of fixups. This This usually indicates a problem in the Formatter.
The issue here is that, when binary serialization occurred, the object type was saved with the binary data. In this case, the object type was Classes.clsGenericCollection`1[Classes.clsNCPDP]. When deserialization occurs, the object type is attempted instantiated. Because we changed namespaces, this object is no longer valid.
The solution was to create a SerializationBinder object that dictates which type to bind to. The interesting code is:
Public
Overrides
Function BindToType(ByVal assemblyName As
String, ByVal typeName As
String) As System.Type
If typeName.Contains("Classes.clsNCPDP") Then
typeName = typeName.Replace("Classes.clsNCPDP", "BioWoRx.BusinessLogic.clsNCPDP")
End
If
If typeName.Contains("Classes.clsGenericCollection") Then
typeName = typeName.Replace("Classes.clsGenericCollection", "BioWoRx.BusinessLogic.clsGenericCollection")
End
If
Return Type.GetType(String.Format("{0}, {1}", typeName, assemblyName))
End
Function
This code is used in the application like so:
theFormatter.Binder = New GenericCollectionOfNcpdpBindingRedirect()
claim_fields = CType(theFormatter.Deserialize(theStream), clsGenericCollection(Of clsNCPDP))
Tuesday, September 7, 2010
Git and CURL
"Error setting certificate verify locations:"...
The solution was found here - and thank you very much! It is basically issuing the command:
git config --system http.sslcainfo \bin/curl-ca-bundle.crt