question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.InvalidOperationException : Could not create an instance of type 'Google.Cloud.Diagnostics.Common.IManagedTracer'. Model bound complex types must not be abstract or value types and must have a parameterless constructor.

See original GitHub issue

Hi,

using .net core 1.1, and package <PackageReference Include="Google.Cloud.Diagnostics.AspNetCore" Version="1.0.0-alpha07" />

Mac:UDL-API$ dotnet --info
.NET Command Line Tools (1.0.1)

Product Information:
 `Version:`            1.0.1
 Commit SHA-1 hash:  005db40cd1

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/1.0.1

i get the error ’ System.InvalidOperationException : Could not create an instance of type ‘Google.Cloud.Diagnostics.Common.IManagedTracer’. Model bound complex types must not be abstract or value types and must have a parameterless constructor.’

  • startup.Configure() contains app.UseGoogleTrace()
  • startup.ConfigureServices() contains services.AddGoogleTrace(Configuration[“AppSettings:GoogleProjectID”]);
  • my post http controller contains tracer.StartSpan(nameof(GetWellData)); (& endspan()).

That may be an issue on my side, but the documentation at http://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.Diagnostics.AspNetCore/ does not really give much more clue on what is going on.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
iantalaricocommented, Mar 30, 2017

@Jonathan34 also a note (I will add this in the docs when I update them) the IManagedTracer is a singleton. I would suggest injecting it into the constructor of the controller and using it that way (no need for the [FromServices] attribute).

1reaction
iantalaricocommented, Mar 30, 2017

@Jonathan34 Awesome glad everything is working. I will be sure to add an example to our docs to make this a little more clear.

I’ll use this to track updating the docs and close this once I have a PR in.

Thanks for the feedback!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Model bound complex types must not be abstract or value ...
Model bound complex types must not be abstract or value types and must have a parameterless constructor. Let's try and break this error...
Read more >
Google.Cloud.Diagnostics.Common
Google.Cloud.Diagnostics.Common is a .NET Core instrumentation library for Google Logging, Error Reporting and Tracing.
Read more >
Google.Cloud.Diagnostics.AspNetCore
Google.Cloud.Diagnostics.AspNetCore is an ASP.NET Core instrumentation library for Google Logging, Error Reporting and Tracing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found