ProfilerApplicationCore contructor sometimes throws excetions

Use this forum to discuss subjects that don't belong in the other forums.
Post Reply
rochar
Posts: 2
Joined: Fri Apr 09, 2021 10:06 am

ProfilerApplicationCore contructor sometimes throws excetions

Post by rochar » Fri Nov 05, 2021 9:47 am

Hi,

When running multiple tests sequential, in each of the tests a ProfilerApplicationCore is created, and sometimes we have the exception:

Message:
System.InvalidOperationException : Cannot change default WinStoreHelper.

Stack Trace:
WinStoreHelper.InitDefault(WinStoreHelper winStoreHelper)
ProfilerApplicationCore.ctor()

Code: Select all

public void ExampleTest()
{
	ProfilerApplicationCore application = new ProfilerApplicationCore();

	var process = Process.GetProcessesByName("TestApp").First();
	int processId = process.Id;

	// Using ProfilingType.Attach to attach to a process.
	// The name argument is just used for presentation. The process id must be specified explicitly.
	var profileProcessStartInfo = new ProfileProcessStartInfo(ProfilingType.Attach, "FARO.CAM2.exe")
	{
		ProcessId = processId, AttachType = AttachType.NoAPI, UseDumpFile = true
	};
				
	using ActiveSession activeSession = application.CreateSession(profileProcessStartInfo);
	// Start it 
	activeSession.Start(TimeSpan.FromMinutes(5));
	// Collect a snapshot
	activeSession.CollectSnapshot(SnapshotCollection.None);

        //Do stuff on TestApp

	// Collect a snapshot
	activeSession.CollectSnapshot(SnapshotCollection.None);
	// And stop it
	activeSession.Stop();
}
Thanks
Ricardo

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests