vs2015 Add ServiceStack Reference Error

when I used ServiceStackVS 1.0.24 and ServiceStack 4.0.56. Add ServiceStack Reference, It works fine.
But After I update the ServiceStackVS 1.0.25 and ServiceStack 4.0.58. It gets something wrong.

First Time.

Error occured while Processing Request: Could not find Markdown page 'ErrorResponse'

2016-06-11 19:11:47.9616 【ERROR】【ServiceStackHost】 ServiceStack.ServiceStackHost.OnLogError ServiceBase::Service Exception 值不能为 null。
参数名: source System.ArgumentNullException ArgumentNullException System.ArgumentNullException: 值不能为 null。
参数名: source
在 System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
在 ServiceStack.NativeTypes.MetadataExtensions.GetIncludeList(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.MetadataExtensions.RemoveIgnoredTypes(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.MetadataExtensions.RemoveIgnoredTypesForNet(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.CSharp.CSharpGenerator.GetCode(MetadataTypes metadata, IRequest request)
在 ServiceStack.NativeTypes.NativeTypesService.Any(TypesCSharp request)
在 lambda_method(Closure , Object , Object )
在 ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto) System.Collections.Generic.IEnumerable`1[TSource] Where[TSource](System.Collections.Generic.IEnumerable`1[TSource], System.Func`2[TSource,System.Boolean]) 在 System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
在 ServiceStack.NativeTypes.MetadataExtensions.GetIncludeList(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.MetadataExtensions.RemoveIgnoredTypes(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.MetadataExtensions.RemoveIgnoredTypesForNet(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.CSharp.CSharpGenerator.GetCode(MetadataTypes metadata, IRequest request)
在 ServiceStack.NativeTypes.NativeTypesService.Any(TypesCSharp request)
在 lambda_method(Closure , Object , Object )
在 ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto) 
2016-06-11 19:11:47.9616 【ERROR】【ServiceStackHost】 ServiceStack.ServiceStackHost.OnLogError Error occured while Processing Request: Could not find Markdown page 'ErrorResponse' Could not find Markdown page 'ErrorResponse' System.IO.InvalidDataException InvalidDataException System.IO.InvalidDataException: Could not find Markdown page 'ErrorResponse'
在 ServiceStack.Formats.MarkdownFormat.SerializeToStream(IRequest request, Object response, Stream stream)
在 ServiceStack.Host.ContentTypes.<>c__DisplayClass3.b__2(IRequest httpReq, Object dto, IResponse httpRes)
在 ServiceStack.HttpResponseExtensionsInternal.WriteErrorToResponse(IResponse httpRes, IRequest httpReq, String contentType, String operationName, String errorMessage, Exception ex, Int32 statusCode)
在 ServiceStack.ServiceStackHost.HandleUncaughtException(IRequest httpReq, IResponse httpRes, String operationName, Exception ex)
在 ServiceStack.HostContext.RaiseAndHandleUncaughtException(IRequest httpReq, IResponse httpRes, String operationName, Exception ex)
在 ServiceStack.HttpResponseExtensionsInternal.HandleResponseWriteException(Exception originalEx, IRequest request, IResponse response, String defaultContentType)
在 ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse response, Object result, ResponseSerializerDelegate defaultAction, IRequest request, Byte[] bodyPrefix, Byte[] bodySuffix)
在 ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse httpRes, IRequest httpReq, Object result, Byte[] bodyPrefix, Byte[] bodySuffix)
在 ServiceStack.Host.RestHandler.<>c__DisplayClass5.b__0(Object response)
在 ServiceStack.Host.Handlers.ServiceStackHandlerBase.HandleResponse(Object response, Func`2 callback, Func`2 errorCallback) Void SerializeToStream(ServiceStack.Web.IRequest, System.Object, System.IO.Stream) 在 ServiceStack.Formats.MarkdownFormat.SerializeToStream(IRequest request, Object response, Stream stream)
在 ServiceStack.Host.ContentTypes.<>c__DisplayClass3.b__2(IRequest httpReq, Object dto, IResponse httpRes)
在 ServiceStack.HttpResponseExtensionsInternal.WriteErrorToResponse(IResponse httpRes, IRequest httpReq, String contentType, String operationName, String errorMessage, Exception ex, Int32 statusCode)
在 ServiceStack.ServiceStackHost.HandleUncaughtException(IRequest httpReq, IResponse httpRes, String operationName, Exception ex)
在 ServiceStack.HostContext.RaiseAndHandleUncaughtException(IRequest httpReq, IResponse httpRes, String operationName, Exception ex)
在 ServiceStack.HttpResponseExtensionsInternal.HandleResponseWriteException(Exception originalEx, IRequest request, IResponse response, String defaultContentType)
在 ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse response, Object result, ResponseSerializerDelegate defaultAction, IRequest request, Byte[] bodyPrefix, Byte[] bodySuffix)
在 ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse httpRes, IRequest httpReq, Object result, Byte[] bodyPrefix, Byte[] bodySuffix)
在 ServiceStack.Host.RestHandler.<>c__DisplayClass5.b__0(Object response)
在 ServiceStack.Host.Handlers.ServiceStackHandlerBase.HandleResponse(Object response, Func`2 callback, Func`2 errorCallback) 
============================================ 

So I Added a file ErrorResponse.md in views folder.
then It get a Error

2016-06-11 19:14:17.9362 【ERROR】【ServiceStackHost】 ServiceStack.ServiceStackHost.OnLogError ServiceBase::Service Exception 值不能为 null。
参数名: source System.ArgumentNullException ArgumentNullException System.ArgumentNullException: 值不能为 null。
参数名: source
在 System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
在 ServiceStack.NativeTypes.MetadataExtensions.GetIncludeList(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.MetadataExtensions.RemoveIgnoredTypes(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.MetadataExtensions.RemoveIgnoredTypesForNet(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.CSharp.CSharpGenerator.GetCode(MetadataTypes metadata, IRequest request)
在 ServiceStack.NativeTypes.NativeTypesService.Any(TypesCSharp request)
在 lambda_method(Closure , Object , Object )
在 ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto) System.Collections.Generic.IEnumerable`1[TSource] Where[TSource](System.Collections.Generic.IEnumerable`1[TSource], System.Func`2[TSource,System.Boolean]) 在 System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
在 ServiceStack.NativeTypes.MetadataExtensions.GetIncludeList(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.MetadataExtensions.RemoveIgnoredTypes(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.MetadataExtensions.RemoveIgnoredTypesForNet(MetadataTypes metadata, MetadataTypesConfig config)
在 ServiceStack.NativeTypes.CSharp.CSharpGenerator.GetCode(MetadataTypes metadata, IRequest request)
在 ServiceStack.NativeTypes.NativeTypesService.Any(TypesCSharp request)
在 lambda_method(Closure , Object , Object )
在 ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto) 
============================================ 

This issue reported earlier should already be fixed on MyGet, we’ll push another release of ServiceStack tomorrow with this fix.

Can you please upgrade to v4.0.59 on MyGet to see that it’s resolved so I can verify it’s not another issue.

After upgrade to v4.0.59, It works Fine.

1 Like

upgrade to v4.0.60 , after Add ServiceStack Reference, It Generate Different Code compare to v4.0.56. Left Side is v4.0.60, Right Side is v4.0.56. The Right Side It works fine. Is there any setting changed after v4.0.60?

My Class Definition.

    /// <summary>
    /// 企业号JSON返回结果
    /// </summary>
    public class QyJsonResult : IJsonResult
    {
        public ReturnCode_QY errcode { get; set; }
        public string errmsg { get; set; }
        /// <summary>
        /// 为P2P返回结果做准备
        /// </summary>
        public virtual object P2PData { get; set; }
    }
    public enum ReturnCode_QY
    {
        请求成功 = 0,
        获取access_token时Secret错误或者access_token无效 = 40001,
        不合法的凭证类型 = 40002,
        不合法的UserID = 40003,
        不合法的媒体文件类型 = 40004,
        不合法的文件类型 = 40005,
        ...
    }

Can you post your original Classes as text?

    [Api("CreaeMember")]
    [Route("/CreateMember")]
    public class CreateMember : IReturn<QyJsonResult>
    {
        public string userId { get; set; }
        public string name { get; set; }
        public int[] department { get; set; }
        public string position { get; set; }
        public string mobile { get; set; }
        public string email { get; set; }
        public string weixinId { get; set; }
        public string avatarMediaid { get; set; }
        public Extattr extattr { get; set; }
        public int timeOut { get; set; }
    }
public class MailListApiService : Service
    {
    public QyJsonResult Any(CreateMember request)
        {
            try
            {
                var extattr = null;
                return MailListApi.CreateMember(accessToken, request.userId, request.name, request.department,
                    request.position, request.mobile, request.email, request.weixinId, null, extattr);
            }
            catch (ErrorJsonResultException ex)
            {
                return new QyJsonResult
                {
                    errcode = (ReturnCode_QY)ex.JsonResult.errcode,
                    errmsg = ex.Message
                };
            }
        }
   }

Should now be fixed in this commit, this change is now available from v4.0.61 that’s now available on MyGet.