Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Reflection.TargetParameterCountException: Parameter count mismatch. #9

Open
sagarkul opened this issue Jan 23, 2018 · 4 comments

Comments

@sagarkul
Copy link

I have MyResource.cs contains List and List.
Here I am getting an error as follow.

System.Reflection.TargetParameterCountException: Parameter count mismatch. at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at CareMentor.Web.Filters.LinkRewritingFilter.RewriteLinksInNestedObjects(IEnumerable1 objectProperties, Object obj, LinkRewriter rewriter) in C:\Web\Filters\LinkRewritingFilter.cs:line 95
at CareMentor.Web.Filters.LinkRewritingFilter.RewriteAllLinks(Object model, LinkRewriter rewriter) in C:\Web\Filters\LinkRewritingFilter.cs:line 79
at CareMentor.Web.Filters.LinkRewritingFilter.RewriteLinksInNestedObjects(IEnumerable1 objectProperties, Object obj, LinkRewriter rewriter) in C:\Web\Filters\LinkRewritingFilter.cs:line 95 at CareMentor.Web.Filters.LinkRewritingFilter.RewriteAllLinks(Object model, LinkRewriter rewriter) in C:\Web\Filters\LinkRewritingFilter.cs:line 79 at CareMentor.Web.Filters.LinkRewritingFilter.RewriteLinksInArrays(IEnumerable1 arrayProperties, Object obj, LinkRewriter rewriter) in C:\Web\Filters\LinkRewritingFilter.cs:line 111
at CareMentor.Web.Filters.LinkRewritingFilter.RewriteAllLinks(Object model, LinkRewriter rewriter) in C:\Web\Filters\LinkRewritingFilter.cs:line 76
at CareMentor.Web.Filters.LinkRewritingFilter.d__2.MoveNext() in C:\Web\Filters\LinkRewritingFilter.cs:line 38
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at CareMentor.Web.Startup.<>c.<b__5_0>d.MoveNext() in C:\Web\Startup.cs:line 149
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.d__6.MoveNext()`

@nbarbettini
Copy link
Owner

Interesting! I'll take a look at this when I can. Are you following my video course, or just trying out this code yourself?

Can you paste your MyResource definition?

@carlosmacbeath
Copy link

I' m geeting and error using net core 2
pastedimage

@sagarkul
Copy link
Author

here is my resource class

public class MyResource { public ChannelDetailResource ChannelDetail { get; set; } public string TopicName { get; set; } public string TopicDescription { get; set; } [JsonConverter(typeof(StringEnumConverter))] public MediaType MediaType { get; set; } public string ThumbnailUrl { get; set; } public string ContentUrl { get; set; } [JsonConverter(typeof(StringEnumConverter))] public List<ContentCategory> Categories { get; set; } [JsonConverter(typeof(StringEnumConverter))] public List<Disease> Diseases { get; set; } public string Source { get; set; } [JsonConverter(typeof(StringEnumConverter))] public ContentLevel Level { get; set; } public string Notes { get; set; } public string CuratedBy { get; set; } public string Language { get; set; } public double Duration { get; set; } public bool View { get; set; } public bool Like { get; set; } public bool Dislike { get; set; } }

@rclanan
Copy link

rclanan commented Apr 20, 2018

public class MyResource : Resource

You need to make sure it inherits from Resource or you will see that error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants