OYIon / LiveSharp

Public repository for the LiveSharp project
96 stars 4 forks source link

KeyNotFound Exception #74

Closed jh-webton closed 4 years ago

jh-webton commented 4 years ago

I'm upgraded to the latest server software & nuget package. The server info screen says: License: Valid until vrijdag 19 juni 2020

After recieving the following exception the program stops working livesharp: error: System.Collections.Generic.KeyNotFoundException: The given key '7' was not present in the dictionary. at System.Collections.Generic.Dictionary2.get_Item(TKey key) at LiveSharp.Runtime.IL.DocumentMetadata.<>c__DisplayClass16_0.b__2(Int32 t) at System.Linq.Enumerable.SelectArrayIterator2.ToArray() at LiveSharp.Runtime.IL.DocumentMetadata.DeserializeTypes(XElement[] types) at LiveSharp.Runtime.IL.DocumentMetadata..ctor(XElement documentElement, VirtualAssembly virtualAssembly, ILogger logger, Func2 methodFilter) at LiveSharp.Runtime.LiveSharpRuntime.UpdateDocument(XElement element, Func2 methodFilter) at LiveSharp.Runtime.LiveSharpRuntime.LiveSharpMessageReceived(String messageContent, Byte contentType, Int32 groupId) The thread 0xbb18 has exited with code 0 (0x0).

The exception is shown in Visual Studio 2019 output window. Don't see any messages in the server application.

ionoy commented 4 years ago

Do you have a code sample I could use to reproduce the issue?

ionoy commented 4 years ago

Please see if it works with this NuGet package. Thanks!

LiveSharp.1.5.24.zip

jh-webton commented 4 years ago

No more exception but the page isn't updated anymore

ionoy commented 4 years ago

What if you manually reload it with F5? Do you see the updated version or the old one?

jh-webton commented 4 years ago

The old one, both with F5 and CTRL-F5

ionoy commented 4 years ago

Please check if there are any other messages in the logs or Output window. I have created a similar page to test your code and after 1.5.24 it updates fine.

jh-webton commented 4 years ago

Just tested it again and I get this message in the logs

14:15:31 (runtime) LiveSharp Server connected 14:15:32 client connected: 127.0.0.1:53073 14:15:32 Client 127.0.0.1:53073 joined group 7 14:15:32 Client 127.0.0.1:53073 joined group 6 14:15:32 Error: EndReceive failed System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options) at System.Xml.Linq.XDocument.Parse(String text) at LiveSharp.ServerApp.HostServer.HandleMessage(ServerMessage message) in C:\Projects\LiveSharp\src\LiveSharp.ServerApp\HostServer.cs:line 112 at LiveSharp.ServerApp.Network.LiveServer.MessageReceived(ServerMessage message, Client client) in C:\Projects\LiveSharp\src\LiveSharp.Server\Network\LiveServer.cs:line 108 at LiveProjectCommon.Server.LiveHost.Parser_MessageParsed(Object sender, ParserEventArgs1 args) in C:\Projects\LiveSharp\src\LiveSharp.Server\Network\LiveHost.cs:line 79 at LiveSharp.ServerClient.ParserBase1.RaiseMessageReceived(TMessage message, Object payload) in C:\Projects\LiveSharp\src\LiveSharp.ServerClient\ParserBase.cs:line 33 at LiveSharp.ServerClient.MessageParser.Feed(Byte b) in C:\Projects\LiveSharp\src\LiveSharp.ServerClient\MessageParser.cs:line 107 at LiveSharp.ServerClient.ParserBase`1.Feed(Byte[] buffer, Int32 bytesRead) in C:\Projects\LiveSharp\src\LiveSharp.ServerClient\ParserBase.cs:line 20 at LiveProjectCommon.Server.LiveHost.EndReceive(IAsyncResult ar) in C:\Projects\LiveSharp\src\LiveSharp.Server\Network\LiveHost.cs:line 112 14:15:32 client disconnected: 127.0.0.1:53073

ionoy commented 4 years ago

LiveSharp.1.5.25.zip

This should work

jh-webton commented 4 years ago

@ionoy, perfect. Works like a charm and I don't see any error messages in the logs