내 생성자는 다음이다 (C++ lib 디렉토리에 대한 래퍼 만들기)System.AccessViolationException : '보호 된 메모리를 읽거나 쓰려고 시도했습니다.
ScaperEngine::ScaperEngine(GrabberType grabberType, bool timing) {
switch (grabberType)
{
case GrabberType::DepthSenseGrabber:
this->interface = new pcl::DepthSenseGrabber("");
break;
default:
throw new std::exception("Grabber type wasn't chosen correctly");
break;
}
executionPipeline = new ExecutionPipeline();
executionPipeline->setTiming(timing);
}
그리고 내가 좋아하는 몇 가지 코드를 가지고 :
void ScaperEngine::StartPipeline()
{
IPCLNormalCalculator* normalCalculator = new PCLNormalCalculator(normalCalcMaxDepthChangeFactor, normalSmoothingSize);
executionPipeline->SetPCLNormalCalculator(normalCalculator);
가장 이상한 것은 생성자에 executionPipeline를 구축하고 있다는 점이다 0x0000020ef385e830의 메모리에 그 위치를 저장하는 올바른 방법이지만, C# 관리 코드가 StartPipeline을 호출 할 때 executionPipeline 주소가 0xcdcdcdcdcdcdcdcd로 변경되고 Quick Watch에서 해당 변수에 대해 다음 텍스트가 나타납니다. <Unable to read memory>
.
아무도 실마리가 있습니까?
감사합니다.
나는 대부분의 내가 {ScaperEngine (grabberType, 거짓을)} 다음 ScaperEngine :: ScaperEngine (GrabberType grabberType) 같은 ScaperEngine를 구성하고 있기 때문에, 문제를 발견 –