C# RAML.WebApiExplorer throws exception on /raml/raw


#1

Using WebApi 5.2.3, and RAML.WebApiExplorer 1.1.0.0. When I try and access the URL /raml/raw, I get the following exception:

An item with the same key has already been added.
Line 33: 	        var apiExplorerService = new ApiExplorerService(apiExplorer, config.VirtualPathRoot);
Line 34:             
Line 35: 	        var ramlDocument = apiExplorerService.GetRaml();
Line 36: 
Line 37: 	        var ramlContents = new RamlSerializer().Serialize(ramlDocument);

I’m not sure where to start, in debugging this - but please let me know if I can send some more information.

Stack trace:

[ArgumentException: An item with the same key has already been added.]
   System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52
   System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +12210218
   System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +15
   RAML.WebApiExplorer.ApiExplorerService.GetRequestMimeTypes(ApiDescription api) +939
   RAML.WebApiExplorer.ApiExplorerService.GetMethods(ApiDescription api, ICollection`1 verbs) +463
   RAML.WebApiExplorer.ApiExplorerService.AddMethods(Resource resource, ApiDescription api, ICollection`1 verbs) +104
   RAML.WebApiExplorer.ApiExplorerService.GetRaml(String title) +1911
   RAML.WebApiExplorer.RamlController.GetRamlContents() in \Controllers\RamlController.cs:35
   RAML.WebApiExplorer.RamlController.Raw() in \Controllers\RamlController.cs:18
   lambda_method(Closure , ControllerBase , Object[] ) +61
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +30
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +197
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +46
   System.Web.Mvc.Async.ActionInvocation.InvokeSynchronousActionMethod() +37
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +24
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +43
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +68
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +69
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +230
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +68
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +42
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +124
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +29
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +27
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +48
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +21
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +32
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +26
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +40
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +21
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +24
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +27
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +48
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +58
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +30
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +21
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +29
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +23
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9711525
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

#2

Hi @Kevin_Blake, can you raise this issue on the Github repo. Where did you get that tool from? Maybe I can identify the Github repo for you.


#3

Thanks @christian_vogel,

I got the tool from here:

But I guess the issue is actually related to this one, as a component of that tool?

Any advice on which I should add it to?


#4

Yep, the second looks good.


#5

Great - thank you!

For future reference / anyone else who comes here - this issue is added to github here:

github.com/mulesoft-labs/raml-dotnet-apiexplorer/issues/1