Issues related to reprojection in Shapefile.ReprojectCore
When not reprojecting-in-place, shapes and attributes are copied from the source Shapefile to the destination Shapefile. This process allows for the bypassing of Shapes that could not be reprojected, in which case the source row index will get out-of-sync with the target row index. This was properly coded for the EditInsertShape call, but when copying the Shapefile attributes (EditCellValue), the source row index was being used for the target row, resulting in an out-of-range exception for the target row.
Additionally, while iterating the Shapes, a VARIANT_BOOL is used to capture the result of individual library calls (specifically, EditInsertShape and EditCellValue). However, the value of the VARIANT_BOOL is never observed during the iteration, so it may be toggling between true and false, and whatever value it has at the end of the iteration is (inappropriately) used to determine the success or failure of the reprojection. This method will be slightly restructured to properly capture success or failure.
When Shapefile.ReprojectInPlace calls ReprojectCore, it hands in a nullptr for the Shapefile** parameter, and sets the reprojectInPlace flag = true. Every time the Shapefile** is referenced, it should be conditional, based on the value of reprojectInPlace being false. However, there is one call, ClearShapefileModifiedFlag, which is not called conditionally, and the method throws a Null Reference exception in this case.
The following bulleted comments correspond to the bullets in the original issue Description.
This section of code, that copies the Shapefile attributes, has been more specifically documented, using a variable named newIndex, which tracks the next valid shape index of the target Shapefile.
The original intent of the code was to use the VARIANT_BOOL result of the Projection.CopyFrom call at the end of the function, rather than the result of the most recent EditCellValue call. All that was necessary was to reset the variable to VARIANT_FALSE just prior to the Projection.CopyFrom call.
The call to ClearShapefileModifiedFlag now properly considers the reprojectInPlace flag.