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 issueHi,
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:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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).
@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!