Skip to content

Commit

Permalink
Fix initialization bugs (#8)
Browse files Browse the repository at this point in the history
* update nuspec

* fix bug in ProfilerFrontEndClientFactory

* fix bug in ProfilerFrontEndClientFactory

* fix bug in ProfilerFrontEndClientFactory

* fix typo

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: j-zhong-ms <107880703+j-zhong-ms@users.noreply.github.com>

---------

Signed-off-by: j-zhong-ms <107880703+j-zhong-ms@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • Loading branch information
j-zhong-ms and Copilot authored Dec 14, 2024
1 parent af8a87e commit 67d762a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
<file src="bin\$configuration$\$targetFramework$\Microsoft.ServiceProfiler.Contract.Agent.pdb" target="lib/$targetFramework$"></file>
<file src="bin\$configuration$\$targetFramework$\Microsoft.ServiceProfiler.Contract.Agent.Profiler.dll" target="lib/$targetFramework$"></file>
<file src="bin\$configuration$\$targetFramework$\Microsoft.ServiceProfiler.Contract.Agent.Profiler.pdb" target="lib/$targetFramework$"></file>
<file src="bin\$configuration$\$targetFramework$\Microsoft.ServiceProfiler.HttpPipeline.dll" target="lib/$targetFramework$"></file>
<file src="bin\$configuration$\$targetFramework$\Microsoft.ServiceProfiler.HttpPipeline.pdb" target="lib/$targetFramework$"></file>
<file src="bin\$configuration$\$targetFramework$\Microsoft.ServiceProfiler.Logging.dll" target="lib/$targetFramework$"></file>
<file src="bin\$configuration$\$targetFramework$\Microsoft.ServiceProfiler.Logging.pdb" target="lib/$targetFramework$"></file>
<file src="bin\$configuration$\$targetFramework$\Microsoft.ServiceProfiler.Orchestration.dll" target="lib/$targetFramework$"></file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ public IProfilerFrontendClient CreateProfilerFrontendClient()
ActivatorUtilities.CreateInstance<AADAuthTokenCredential>(_serviceProvider) :
null;

return ActivatorUtilities.CreateInstance<ProfilerFrontendClient>(
_serviceProvider,
_serviceProfilerContext.StampFrontendEndpointUrl,
// ActivatorUtilities is not used for creating ProfilerFrontendClient due to its limitation in handling nullable parameters.
// For example, when credential is null, it will throw InvalidOperationException:
// A suitable constructor for type 'Microsoft.ServiceProfiler.Agent.FrontendClient.ProfilerFrontendClient' could not be located.
// Because CreateProfilerFrontendClient method is only called in ServiceCollectionExtensions, it will be disposed by the service provider.
return new ProfilerFrontendClient(_serviceProfilerContext.StampFrontendEndpointUrl,
_serviceProfilerContext.AppInsightsInstrumentationKey,
_serviceProfilerContext.MachineName,
"1.0.0",
Expand Down

0 comments on commit 67d762a

Please sign in to comment.