Scope-IT / marksman

Windows agent for Snipe-IT asset management system
Apache License 2.0
132 stars 23 forks source link

Error on first run "Unhandled Exception" #39

Open AndreBrio opened 3 years ago

AndreBrio commented 3 years ago

Hello all

on my first client, where i'm testing snipeit and your agent we receive an error as show below. On snipeit I can see only the category "Laptop" has been created

C:\Program Files (x86)\Scope-IT\Marksman>Marksman.exe 18/02/2021 19:44:50: Started application. HTTP 200: Connection to Snipe-IT instance succeded. Attempting to create type: SnipeSharp.Endpoints.Models.Manufacturer Instance name: FUJITSU Attempting to create type: SnipeSharp.Endpoints.Models.Category Instance name: Laptop

Unhandled Exception: Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Boolean'. Path 'rows[0].eula', line 1, position 108. ---> System.InvalidCastException: Null object cannot be converted to a value type. 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) --- End of inner exception stack trace --- at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor1 creator, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator) 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.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) 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.CreateValueInternal(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 Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) at SnipeSharp.Endpoints.EndpointManager1.FindOne(ISearchFilter filter) at SnipeSharp.Endpoints.EndpointManager`1.Create(T toCreate) at Marksman.Broker.SyncAll(SnipeItApi snipe, Asset currentAsset, Model currentModel, Manufacturer currentManufacturer, Category currentCategory, Company currentCompany, StatusLabel currentStatusLabel, Location currentLocation) at Marksman.Marksman.Main(String[] args)

C:\Program Files (x86)\Scope-IT\Marksman>

rickardhildingsson commented 3 years ago

I have same issue and really like snipe-it but is needing an automation of this

FRP974 commented 3 years ago

Hi, I see the same problem on a first installation of the solution. Also on a Fujitsu workstation, I don't know if it's a common point, but all our computers are on this manufacturer. Too bad, I really want to use this application.

hatemfares commented 3 years ago

I have same issue

ReticentRobot commented 3 years ago

This seems to be a bug when running Snipe-IT version 5+ as seen here: https://github.com/Scope-IT/marksman/issues/37

I've posted a potential solution at the bottom of that thread.

ReticentRobot commented 3 years ago

I haven't been able to get in touch with the developer, so have started my own version of the project. You can download it here if you are interested: https://github.com/ReticentRobot/SnipeAgent

snelzing commented 10 months ago

I haven't been able to get in touch with the developer, so have started my own version of the project. You can download it here if you are interested: https://github.com/ReticentRobot/SnipeAgent

Did you fix the issue?

ReticentRobot commented 10 months ago

I haven't been able to get in touch with the developer, so have started my own version of the project. You can download it here if you are interested: https://github.com/ReticentRobot/SnipeAgent

Did you fix the issue?

Yes, it has been a long while - but the version I have has the fix in it that I mentioned above.

snelzing commented 10 months ago

I haven't been able to get in touch with the developer, so have started my own version of the project. You can download it here if you are interested: https://github.com/ReticentRobot/SnipeAgent

Did you fix the issue?

Yes, it has been a long while - but the version I have has the fix in it that I mentioned above.

Cool - out of curiosity how did you wound up fixing it?

ReticentRobot commented 10 months ago

Lol, nothing too much - I couldn't remember what it was but found this comment I left back then, this is all I did:

"Disclaimer: I am not a programmer

I've found that if you change line 45 in Category.cs in the SnipeSharp project from:

public bool eula { get; set; }

to

public string eula { get; set; }

that this will get the agent working on 5.x"