GroupShareKit throwing exception from Project.Get("...")

I'm using GroupShareKit (2015 branch) which uses v1 of the GroupShare REST API to communicate with GroupShare 2017. Everything else I've tried so far works fine except for

GroupShareClient.Project.Get("projectGuidAsString");

Which throws the following exception:

   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Sdl.Community.GroupShareKit.Http.JsonHttpPipeline.DeserializeResponse[T](IResponse response) in C:\Work\Git\groupsharekit.net\Sdl.Community.GroupShareKit\Http\JsonHttpPipeline.cs:line 60
   at Sdl.Community.GroupShareKit.Http.Connection.<Run>d__19`1.MoveNext() in C:\Work\Git\groupsharekit.net\Sdl.Community.GroupShareKit\Http\Connection.cs:line 0
--- 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 Sdl.Community.GroupShareKit.Http.ApiConnection.<Get>d__4`1.MoveNext() in C:\Work\Git\groupsharekit.net\Sdl.Community.GroupShareKit\Http\ApiConnection.cs:line 0
--- 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 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at GroupShareKit.Supertext.GroupShareKitFacade.ProjectFacade.<Get>d__5.MoveNext() in C:\Workspaces\supertext-dev\GroupShareKit.Supertext\GroupShareKitFacade\ProjectFacade.cs:line 151

 

I know that the specified project ID definitely exists.

Can anyone confirm that there is an underlying change in how GroupShare handles this REST request - and that v1 of the REST API now functions slightly differently?

Any workarounds?

Parents
  • Former Member
    0 Former Member
    Hi

    Can you send me the full text of the exception which contains also the "ExceptionType"?

    Regards,
    Alexandru-Constantin Pascariu
  • Exception Type: JsonSerializationException
    Exception Message: "Error converting value {null} to type 'System.DateTime'. Path 'DueDate', line 1, position 221."
    Exception Stack Trace:
      at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
      at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
      at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
      at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
      at Sdl.Community.GroupShareKit.Http.JsonHttpPipeline.DeserializeResponse[T](IResponse response) in C:\Work\Git\groupsharekit.net\Sdl.Community.GroupShareKit\Http\JsonHttpPipeline.cs:line 60
      at Sdl.Community.GroupShareKit.Http.Connection.<Run>d__19`1.MoveNext() in C:\Work\Git\groupsharekit.net\Sdl.Community.GroupShareKit\Http\Connection.cs:line 0
    --- 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 Sdl.Community.GroupShareKit.Http.ApiConnection.<Get>d__4`1.MoveNext() in C:\Work\Git\groupsharekit.net\Sdl.Community.GroupShareKit\Http\ApiConnection.cs:line 0
    --- 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 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
      at GroupShareKit.Supertext.GroupShareKitFacade.ProjectFacade.<Get>d__5.MoveNext() in C:\Workspaces\supertext-dev\GroupShareKit.Supertext\GroupShareKitFacade\ProjectFacade.cs:line 151

     

    Inner Exception Type: InvalidCastException
    Inner Exception Message: "Null object cannot be converted to a value type."
    Inner Exception Stack Trace:
      at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)

     

    Screenshot of Trados Studio exception details showing a JsonSerializationException with message 'Error converting value null to type 'System.DateTime' at path 'DueDate'.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 6:30 AM (GMT 0) on 5 Mar 2024]
  • Former Member
    0 Former Member in reply to Andrew Jameson

    Hello  ,

    The problem occurred because in the GroupShareKit(2015 branch) the "DueDate" was not nullable, you should update to the latest version of GroupShareKit via Nuget, which will fix this issue.
    Hope this helps.




    Regards,
    Alexandru-Constantin Pascariu

Reply Children