Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

(시리즈 글이 6개 있습니다.)
오류 유형: 534. mstest.exe 실행 시 "Visual Studio Enterprise is required to execute the test." 오류
; https://www.sysnet.pe.kr/2/0/11886

개발 환경 구성: 438. mstest, QTAgent의 로그 파일 설정 방법
; https://www.sysnet.pe.kr/2/0/11889

개발 환경 구성: 439. "Visual Studio Enterprise is required to execute the test." 메시지와 관련된 코드 기록
; https://www.sysnet.pe.kr/2/0/11890

오류 유형: 539. mstest 실행 시 "The directory name is invalid." 오류 발생
; https://www.sysnet.pe.kr/2/0/11902

오류 유형: 575. mstest.exe - System.Resources.MissingSatelliteAssemblyException: The satellite assembly named "Microsoft.VisualStudio.ProductKeyDialog.resources.dll, ..."
; https://www.sysnet.pe.kr/2/0/12044

오류 유형: 576. mstest.exe 실행 시 "Visual Studio Enterprise is required to execute the test." 오류 - 두 번째 이야기
; https://www.sysnet.pe.kr/2/0/12045




mstest.exe 실행 시 "Visual Studio Enterprise is required to execute the test." 오류 - 두 번째 이야기

지난 글에서,

mstest.exe 실행 시 "Visual Studio Enterprise is required to execute the test." 오류
; https://www.sysnet.pe.kr/2/0/11886

분명히 Enterprise 버전인데도 제품키를 입력해야만 mstest.exe가 동작하는 것에 대한 설명을 했습니다. 아무래도 마이크로소프트 측의 버그 같은데 아쉽게도 최근 비주얼 스튜디오의 새 프로젝트 창을 보면,

mstest_loadtest_1.png

"Deprecated"라고 나온 걸로 봐서 관련 테스트 프로젝트를 더 이상 신경 쓰지 않는 듯한 모습을 보이고 있습니다. 결국 저 동작이 수정될 가능성이 그다지 높지 않다는 것입니다.




혹시 그럼, 저 동작을 우회할 수는 없을까요? 이를 위해 해당 라이선스 체크가 발생하는 코드를 추적해 보면,

"Visual Studio Enterprise is required to execute the test." 메시지와 관련된 코드 기록
; https://www.sysnet.pe.kr/2/0/11890

결국 다음의 코드에서 IsLicenseGood에 따라 결정되는 것을 볼 수 있습니다.

private void UpdateLicensingInformation(IVsClientRights clientRights)
{
    if (clientRights == null)
    {
        WebTestLoadTrace.Error("LicenseHandler.UpdateLicensingInformation(): unable to fetch clientRights ");
    }
    else if (!clientRights.IsLicenseGood)
    {
        WebTestLoadTrace.Error("LicenseHandler.UpdateLicensingInformation(): clientrights' license is not valid.");
    }
    else
    {
        this.AvailableFeatures = 4;
        _VSLicenseType licenseType = (_VSLicenseType) clientRights.LicenseType;
        this.IsLicensedForAllLoadTestFeatures = ((this.IsLicensedForLoadTest && (licenseType != _VSLicenseType.VSLICTYPE_UNKNOWN)) && ((licenseType != _VSLicenseType.VSLICTYPE_TrialPID) && (licenseType != _VSLicenseType.VSLICTYPE_VSExtensionTrial))) && (licenseType != _VSLicenseType.VSLICTYPE_PrereleaseTrialPID);
        WebTestLoadTrace.Verbose("LicenseHandler.UpdateLicensingInformation(): licenseType: " + licenseType);
        if (this.IsLicensedForAllLoadTestFeatures)
        {
            this.AvailableFeatures |= 8;
            this.AvailableFeatures |= 0x20;
        }
    }
}

그렇다면 이 코드를 profiler 기술을 이용해,

라이선스까지도 뛰어넘는 .NET Profiler
; https://www.sysnet.pe.kr/2/0/1046

다음과 같은 식으로 IsLicenseGood의 IL 코드를 무조건 1을 반환하도록 변경하면 됩니다.

vector<BYTE> ilCodes;

ilCodes.push_back(CEE_LDC_I4_1);
ilCodes.push_back(CEE_RET);

IMAGE_COR_ILMETHOD ilHeader;
ilHeader.Tiny.Flags_CodeSize = (BYTE)((ilCodes.size() << 2) | CorILMethod_TinyFormat);

size_t allocationSize = ilCodes.size() + sizeof(ilHeader.Tiny);

BYTE* pAllocated = (BYTE*)pMalloc->Alloc((ULONG)allocationSize);

BYTE* pBytes = pAllocated;
memcpy(pBytes, &ilHeader.Tiny, sizeof(ilHeader.Tiny));
pBytes += sizeof(ilHeader.Tiny);

memcpy(pBytes, ilCodes.data(), ilCodes.size());
pBytes += ilCodes.size();

m_pICorProfilerInfo->SetILFunctionBody(moduleId, methodToken, (LPCBYTE)pAllocated);

이후, 비교를 위해 예전 그대로 실행해 보면 "Visual Studio Enterprise is required to execute the test." 오류가 발생하지만,

C:\temp> mstest /testcontainer:loadtest1.loadtest
Microsoft (R) Test Execution Command Line Tool Version 16.0.28326.58
Copyright (c) Microsoft Corporation. All rights reserved.

Loading loadtest1.loadtest...
Starting execution...

Results               Top Level Tests
-------               ---------------
Error                 loadtest1.loadtest
0/1 test(s) Passed, 1 Error

Summary
-------
Test Run Warning.
  Error  1
  --------
  Total  1
Results file:  C:\temp\TestResults\%USERNAME%_TESTPC 2019-05-23 23_30_15.trx
Test Settings: Default Test Settings

Run has the following issue(s):
Visual Studio Enterprise is required to execute the test.

V, 11892, 1, 2019/05/23, 08:54:16.573, TESTPC\mstest, WebLoadTestAdapter: LicenseHandler.InitializeLoadTestLicenseInfo(): skuEdition: VSEDITION_Ultimate
E, 11892, 1, 2019/05/23, 08:54:16.990, TESTPC\mstest, WebLoadTestAdapter: LicenseHandler.UpdateLicensingInformation(): clientrights' license is not valid.

profiler를 등록한 다음,

C:\temp> SET COR_ENABLE_PROFILING=1
C:\temp> SET COR_PROFILER={...}

다시 실행해 보면 정상적으로 loadtest에 대한 시나리오를 수행하게 될 것입니다.

(혹시나, 저 동작이 마이크로소프트의 버그가 아니라 의도된 라이선스 수행 과정일 수 있으므로 이 글에 대한 바이너리나 전체 소스 코드는 공개하지 않습니다.)




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 10/27/2019]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 151  152  153  154  155  156  157  158  [159]  160  161  162  163  164  165  ...
NoWriterDateCnt.TitleFile(s)
1070정성태6/19/201127607.NET Framework: 222. Windows Azure - VM Role 베타 프로그램 참여 [2]
1069정성태6/18/201127718.NET Framework: 221. Cache 영향을 받지 않는 DNS 이름 풀이 [2]파일 다운로드1
1068정성태6/16/201125332개발 환경 구성: 127. Portable Library - 닷넷 N-Screen용 공통 라이브러리 제작 [1]
1067정성태6/15/201124902오류 유형: 126. Windows failed to apply the Group Policy Folder Options settings. [1]
1066정성태6/14/201127890개발 환경 구성: 126. MSDN 구독자 - Windows Azure 무료 서비스 신청하는 방법 [4]
1065정성태6/13/201132708개발 환경 구성: 125. Firebird - 유니코드 기본 문자셋 지정
1064정성태6/11/201127356웹: 22. Visual Studio 2010에서 CSS 3 인텔리센스(intellisense) 지원하는 방법 [1]
1063정성태6/10/201128964웹: 21. Sysnet 웹 사이트의 CSS 2.1 변환 기록 [1]
1062정성태6/9/201129162웹: 20. Sysnet 웹 사이트의 HTML5 변환 기록 [1]
1061정성태6/8/201127387오류 유형: 125. 인터넷 익스플로러 - 개발자 도구에서 정지점(BP: Breakpoint) 설정이 안 되는 경우 [1]
1060정성태6/8/201123957VC++: 51. PHP 모듈의 F5 디버깅
1059정성태6/6/201129091VC++: 50. PHP 모듈 - php_mysql 빌드하는 방법파일 다운로드1
1058정성태6/5/201132709개발 환경 구성: 124. .NET 개발자가 처음 해보는 PHP + MySQL 연동 [2]
1057정성태6/4/201130066VC++: 49. 소스 코드로부터 php5apache2_2.dll 생성하는 방법파일 다운로드1
1056정성태6/2/201128256VC++: 48. 윈도우에서 Apache Module - Content Handler 컴파일파일 다운로드1
1055정성태6/1/201125459오류 유형: 124. MVC 프로젝트의 Site.Master 관련 오류 정리
1054정성태5/31/201129715.NET Framework: 220. ASP.NET MVC Web Site 프로젝트 - 단위 테스트 작성파일 다운로드1
1053정성태5/31/201132251VC++: 47. Apache Module에 대한 'F5 디버그 (Start with debugging)' [2]
1052정성태5/30/201129879.NET Framework: 219. ASP.NET MVC Web Site 프로젝트 구성하기파일 다운로드1
1051정성태5/28/201138370VC++: 46. 윈도우에서 Apache Module 컴파일 (VC++)파일 다운로드1
1050정성태5/28/201124549오류 유형: 123. Firebird - Exception of type 'FirebirdSql.Data.Common.IscException' was thrown.
1049정성태5/28/201130230.NET Framework: 218. WCF REST 서비스 - 웹 브라우저 측 Ajax 호출 캐시 [1]
1048정성태5/27/201132165개발 환경 구성: 123. Apache 소스를 윈도우 환경에서 빌드하기
1047정성태5/27/201126034.NET Framework: 217. Firebird ALinq Provider - 날짜 필드에 대한 낙관적 동시성 쿼리 오류
1046정성태5/26/201130659.NET Framework: 216. 라이선스까지도 뛰어넘는 .NET Profiler [5]
1045정성태5/24/201131748.NET Framework: 215. 닷넷 System.ComponentModel.LicenseManager를 이용한 라이선스 적용 [1]파일 다운로드1
... 151  152  153  154  155  156  157  158  [159]  160  161  162  163  164  165  ...