Import invalid mesh and save its data

Hi, I meet an werid problem in RhinoCommon
I drag an invalid (with non-manifold vertices and edges) triangle mesh .obj file into UI to import.

when I picked it, it shows pMesh->IsValid = true. I guess Rhino did some automatic mesh cleanning during importing stage.

bool SelectErrorMesh(std::shared_ptr<ON_Mesh>& outErrorMesh) {
        // pick mesh
		RhinoApp().ActiveDoc()->UnselectAll();
		CRhinoGetObject go1;
		go1.SetCommandPrompt(L"Select Error Mesh");
		go1.EnablePreSelect(FALSE);	
		go1.SetGeometryFilter(CRhinoGetObject::mesh_object);
		go1.GetObjects(1, 0);		
		if (go1.CommandResult() != CRhinoCommand::success)
			return false;

		const CRhinoObject* pObj1 = go1.Object(0).Object();
		const CRhinoMeshObject* pMeshObj = CRhinoMeshObject::Cast(pObj1);
		const ON_Mesh* pMesh = pMeshObj->Mesh();

		// checkout
		ON_wString str;
		ON_TextLog log(str);
		if (!pMesh->IsValid(&log)) {
			RhinoApp().Print(static_cast<const wchar_t*>(str));
			return false;
		}

        // save mesh
		outErrorMesh.reset(pMesh->Duplicate());	
		return true;
	}

then I save the mesh data into my data structure SPMesh like:

SPMesh::SPMesh(const ON_Mesh*& rhinoMesh)
		:m_rMesh(rhinoMesh) {
		// get mesh data
		ON_3fPointArray on_vertices = m_rMesh->m_V;					// vertices
		ON_SimpleArray<ON_MeshFace> on_faces = m_rMesh->m_F;		// faces

		// save mesh data
		Eigen::MatrixXd tempVertices(on_vertices.Count(), 3);
		Eigen::MatrixXi tempFaceConnectivitys(on_faces.Count(), 3);


		for (int i = 0; i < on_vertices.Count(); ++i) {
			tempVertices.row(i) << on_vertices[i].x, on_vertices[i].y, on_vertices[i].z;
		}

		for (int i = 0; i < on_faces.Count(); ++i) {
			tempFaceConnectivitys.row(i) << on_faces[i].vi[0], on_faces[i].vi[1], on_faces[i].vi[2];
		}

		this->vertices = tempVertices;
		this->faceConnectivitys = tempFaceConnectivitys;
	}

finally, display it in Rhino. But it shows that mesh->IsValid() = false:

ON_Mesh* SPMesh::ToRhinoMesh() const {
		int vNum = this->vertices.rows();
		int fNum = this->faceConnectivitys.rows();

		if (0 == vNum) return nullptr;
        // Create ON_Mesh
		ON_Mesh* mesh = new ON_Mesh(fNum, vNum, false, false);

		for (int i = 0; i < vNum; ++i) {
			ON_3dPoint point(vertices.row(i).x(), vertices.row(i).y(), vertices.row(i).z());
			mesh->SetVertex(i, point);
		}

		for (int i = 0; i < fNum; ++i) {
			mesh->SetTriangle(i, faceConnectivitys.row(i).x(), faceConnectivitys.row(i).y(), faceConnectivitys.row(i).z());
		}

		mesh->Compact();
        
        // Check mesh
		if (!mesh->IsValid()) {
			delete mesh;
			mesh = nullptr;
		}

		return mesh;
	}

Is there something wrong I did in data structrue transformation?
Did i just copy vertices which is not be mesh-cleanning to SPMesh?