Skip to content

Commit dd1a231

Browse files
Removed notification profiler code from the test
(cherry picked from commit da7ddd3)
1 parent 112e313 commit dd1a231

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

src/tests/profiler/native/classload/classload.cpp

+9-18
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GUID ClassLoad::GetClsid()
1010
return clsid;
1111
}
1212

13-
HRESULT ClassLoad::InitializeCommon(IUnknown* pICorProfilerInfoUnk)
13+
HRESULT ClassLoad::Initialize(IUnknown* pICorProfilerInfoUnk)
1414
{
1515
Profiler::Initialize(pICorProfilerInfoUnk);
1616

@@ -26,22 +26,6 @@ HRESULT ClassLoad::InitializeCommon(IUnknown* pICorProfilerInfoUnk)
2626
return S_OK;
2727
}
2828

29-
HRESULT ClassLoad::Initialize(IUnknown* pICorProfilerInfoUnk)
30-
{
31-
return InitializeCommon(pICorProfilerInfoUnk);
32-
}
33-
34-
HRESULT ClassLoad::InitializeForAttach(IUnknown* pICorProfilerInfoUnk, void* pvClientData, UINT cbClientData)
35-
{
36-
return InitializeCommon(pICorProfilerInfoUnk);
37-
}
38-
39-
HRESULT ClassLoad::LoadAsNotificationOnly(BOOL *pbNotificationOnly)
40-
{
41-
*pbNotificationOnly = TRUE;
42-
return S_OK;
43-
}
44-
4529
HRESULT ClassLoad::ClassLoadStarted(ClassID classId)
4630
{
4731
_classLoadStartedCount++;
@@ -76,7 +60,14 @@ HRESULT ClassLoad::Shutdown()
7660
if(_failures == 0
7761
&& (_classLoadStartedCount != 0)
7862
// Expect unloading of UnloadLibrary.TestClass and
79-
// List<UnloadLibrary.TestClass> with all its base classes with everything used in List constructor.
63+
// List<UnloadLibrary.TestClass> with all its base classes with everything used in List constructor:
64+
// - UnloadLibrary.TestClass
65+
// - System.Collections.Generic.IEnumerable`1<UnloadLibrary.TestClass>
66+
// - System.Collections.Generic.IList`1<UnloadLibrary.TestClass>
67+
// - System.Collections.Generic.IReadOnlyCollection`1<UnloadLibrary.TestClass>
68+
// - System.Collections.Generic.IReadOnlyList`1<UnloadLibrary.TestClass>
69+
// - System.Collections.Generic.List`1<UnloadLibrary.TestClass>
70+
// - System.Collections.Generic.ICollection`1<UnloadLibrary.TestClass>
8071
&& (_classUnloadStartedCount == 7)
8172
&& (_classLoadStartedCount == _classLoadFinishedCount)
8273
&& (_classUnloadStartedCount == _classUnloadFinishedCount))

src/tests/profiler/native/classload/classload.h

-4
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class ClassLoad : public Profiler
2121

2222
static GUID GetClsid();
2323
virtual HRESULT STDMETHODCALLTYPE Initialize(IUnknown* pICorProfilerInfoUnk);
24-
virtual HRESULT STDMETHODCALLTYPE InitializeForAttach(IUnknown* pICorProfilerInfoUnk, void* pvClientData, UINT cbClientData);
2524
virtual HRESULT STDMETHODCALLTYPE Shutdown();
26-
virtual HRESULT STDMETHODCALLTYPE LoadAsNotificationOnly(BOOL *pbNotificationOnly);
2725

2826
virtual HRESULT STDMETHODCALLTYPE ClassLoadStarted(ClassID classId);
2927
virtual HRESULT STDMETHODCALLTYPE ClassLoadFinished(ClassID classId, HRESULT hrStatus);
@@ -36,6 +34,4 @@ class ClassLoad : public Profiler
3634
std::atomic<int> _classUnloadStartedCount;
3735
std::atomic<int> _classUnloadFinishedCount;
3836
std::atomic<int> _failures;
39-
40-
HRESULT InitializeCommon(IUnknown* pCorProfilerInfoUnk);
4137
};

src/tests/profiler/unittest/classload.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ static int Main(string[] args)
3131
static int RunTest()
3232
{
3333
LoadCollectibleAssembly();
34+
35+
// Force a garbage collection to ensure the assembly is unloaded
3436
GC.Collect();
3537
GC.WaitForPendingFinalizers();
3638
GC.Collect();
@@ -49,7 +51,6 @@ private static void LoadCollectibleAssembly()
4951
object instance = Activator.CreateInstance(testType);
5052

5153
Console.WriteLine(instance.GetHashCode());
52-
GC.Collect();
5354
collectibleContext.Unload();
5455
}
5556
}

0 commit comments

Comments
 (0)