Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiveUpdate failures #281

Closed
TimLariviere opened this issue Jan 16, 2019 · 13 comments
Closed

LiveUpdate failures #281

TimLariviere opened this issue Jan 16, 2019 · 13 comments
Labels
a/liveupdate The issue is regarding LiveUpdate s/ready This issue is ready to be implemented t/bug Something isn't working as expected
Milestone

Comments

@TimLariviere
Copy link
Member

TimLariviere commented Jan 16, 2019

Here is a list of some cases where LiveUpdate fails to run.

Fixed:

@TimLariviere
Copy link
Member Author

From kevkov on Slack

Code:

let theRef = ViewRef<Label>()

Result:

{"Quacked":"couldn't quack! the evaluation of the decalarations in the code package failed: System.Exception: No member found for key (REntity Fabulous.DynamicViews.ViewRef`1[T], \".ctor\",\n RTypes [|Microsoft.FSharp.Core.Unit|])\n 

@kevinha
Copy link

kevinha commented Jan 18, 2019

Assigning an event callback produces an "AddToObservable not supported" error, e.g.
fun (entry:Entry) -> entry.Unfocused.Add(fun args ...

@kevinha
Copy link

kevinha commented Jan 18, 2019

Calling a function that takes unit from a module in a separate dll:

let allSubjects = Database.getProfilesSummary ()

produces

android.runtime.JavaProxyThrowable: System.Exception: No member found for key (REntity Storage+Database, "getProfilesSummary", RTypes [|Microsoft.FSharp.Core.Unit|])

while

let allSubjects = Database.getProfilesSummary 1

is ok.

@dsyme
Copy link
Collaborator

dsyme commented Jan 18, 2019

I'll try to get these fixed today, thanks

@kevinha
Copy link

kevinha commented Jan 19, 2019

Also

let v = [1; 2; 3].Length

produces

android.runtime.JavaProxyThrowable: System.Exception: No member found for key (REntity Microsoft.FSharp.Collections.FSharpList`1[T], "get_Length",
RTypes [|Microsoft.FSharp.Core.Unit|])

@kevinha
Copy link

kevinha commented Jan 19, 2019

After a few iterations of simple changes the app started throwing OutOfMemoryException:

fscd: GOT PortaCode for C:\...\HomePage.fs
fscd: GOT JSON for C:\...\HomePage.fs, length = 11847451
01-19 10:16:48.987 9504-12035/com.moodsnmoves I/mono-stdout: LiveUpdate: setting response code to 500, msg = <html><body><pre>System.AggregateException: One or more errors occurred. ---> System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
        at (wrapper alloc) System.Object.AllocVector(intptr,intptr)
      at System.Text.StringBuilder.ExpandByABlock (System.Int32 minBlockCharCount) [0x00085] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 
      at System.Text.StringBuilder.Append (System.Char* value, System.Int32 valueCount) [0x00082] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 
      at System.Text.StringBuilder.Append (System.Char[] value, System.Int32 startIndex, System.Int32 charCount) [0x00081] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 
      at System.IO.StreamReader+<ReadToEndAsyncInternal>d__63.MoveNext () [0x00046] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 

@dsyme
Copy link
Collaborator

dsyme commented Jan 19, 2019

Assigning an event callback produces an "AddToObservable not supported" error, e.g.
fun (entry:Entry) -> entry.Unfocused.Add(fun args ...

Any chance of a full repro for this? Just so I'm not guessing :)

@dsyme
Copy link
Collaborator

dsyme commented Jan 19, 2019

After a few iterations of simple changes the app started throwing OutOfMemoryException:

Hard to tell what this problem is - it could be we're hitting real limits, or it could be a bug. Is your app open source? I've never seen an OOM while using LiveUpdate. Please also list out your full details of your setup, e.g. device, app size, images being used, any memory usage details

I've fixed all the bugs above except the event handler one in #286.

@kevinha
Copy link

kevinha commented Jan 24, 2019

Sorry, only just seen your replies. For the event handler one:

View.Editor(created=(fun editor -> editor.Unfocused.Add(fun args -> ())))

produces

fscd: GOT PortaCode for C:\...\HomePage.fs
fscd: ERROR SENDING TO WEBHOOK: "System.Exception: error converting rhs of view
System.Exception: NYI: extension of generic type, needs FCS support: AddToObservable
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1645.Invoke(String message)
...

The app is not open source but I can give you access if you want. Its on bitbucket.

@kevinha
Copy link

kevinha commented Jan 24, 2019

@dsyme I've put the app in a private repo on GH and you have been invited. I have been using a Google Pixel API 27 emulator. The memory starts at about 12mb for a newly installed app but then goes up 64mb after a few live update changes and then throws an OOM. It should be fairly easy to reproduce. The code for the inital page is HomePage.fs and you can change the Label at line 138 to get live update feedback.

Please bear in mind this is very much a work in progress, discovery and accruing of technical debt. You can use the code as a source of how not to do things if you like, as long as you don't acknowledge the authors. Of course we'd be glad for any feedback as along as we can respond with weak excuses.

@TimLariviere TimLariviere added t/bug Something isn't working as expected a/liveupdate The issue is regarding LiveUpdate labels Jan 24, 2019
@kevinha
Copy link

kevinha commented Feb 6, 2019

Named fields in DU cases don't work. For example:

    type Metric =
        | Timed of Duration:TimeSpan
        | Repeated of NumberOfRepetitions:int

produces

   System.Exception: couldn't find field NumberOfRepetitions in type DNamedType
      (DEntityRef
         "Models+Metric, Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
       [||])
      at FSharp.Compiler.PortaCode.Interpreter+EvalContext.EvalApplicationOfArg (FSharp.Compiler.PortaCode.Interpreter+Env env, FSharp.Compiler.PortaCode.Interpreter+Value funcV, System.Object[] argsV) [0x0013a] in <5c59d3b72f731447a7450383b7d3595c>:0 
...

@davidtme
Copy link

davidtme commented Jun 13, 2019

I get the same error using live update in a WPF app:

System.Exception: 'couldn't find field Item in type DNamedType
  (DEntityRef
     "Microsoft.FSharp.Core.FSharpChoice`2, FSharp.Core, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
   [|DNamedType
       (DEntityRef
          "Microsoft.FSharp.Collections.FSharpList`1, FSharp.Core, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
        [|DNamedType
            (DEntityRef
               "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
             [||])|]);
     DNamedType
       (DEntityRef
          "System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
        [||])|])'

@TimLariviere TimLariviere added this to the Fabulous 1.0.0 milestone Feb 10, 2020
@TimLariviere TimLariviere modified the milestones: Fabulous 1.0.0, Fabulous for Xamarin.Forms 1.0.0, Fabulous.XF vCurrent (1.0), vCurrent (1.0) Feb 10, 2020
@TimLariviere TimLariviere added s/ready This issue is ready to be implemented and removed proj/xamarinforms labels Feb 18, 2020
@TimLariviere
Copy link
Member Author

Right now in v2, we abandon LiveUpdate. Might come back later in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/liveupdate The issue is regarding LiveUpdate s/ready This issue is ready to be implemented t/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants