Code Monkey home page Code Monkey logo

youiandreactiveui's Introduction

You, I, and ReactiveUI Samples

Book Cover

Buy the book

Errata



Hello!

I'm Kent, the author of these ReactiveUI code samples. I want to make sure you're aware of my book – You, I, and ReactiveUI – for which this code was written. Whilst I consider these samples useful in their own right, you will get far more value out of them by studying them in conjunction with the book.

The book provides in-depth discussion on all things ReactiveUI, giving you the knowledge and understanding required to be highly effective with it. Whether you're new to ReactiveUI, or already proficient in it, I know you'll get a lot of value out of the book. To give you an idea of the content covered, here is the table of contents:

Part 0: First Steps

  • Introduction
  • A ReactiveUI Showcase
  • Getting Started

Part 1: Fundamentals

  • Splat
  • ReactiveObject
  • WhenAny and Friends
  • ObservableAsPropertyHelper
  • Reactive Commands
  • Interactions
  • Reactive Lists
  • Message Bus

Part 2: Platform Integration

  • Events
  • IViewFor
  • Bindings
  • View Location
  • ViewModelViewHost
  • RoutedViewHost
  • WhenActivated
  • Auto Persistence

Part 3: Best Practices

  • Composition
  • Scheduling
  • Error Handling
  • Performance
  • Testing
  • Structure and Style

Part 4: Appendices

  • Appendix A: Reactive Extensions

On top of the extensive content and these fantastic code samples, I put a great deal of effort into typesetting the book. I think you'll agree that the result is a beautiful thing:

Book Preview 1   Book Preview 2
Book Preview 3   Book Preview 4

Hopefully I've convinced you that my efforts to create the very best resource for ReactiveUI programmers was worth it. If you want to support me and my work, please buy the book. If not, that's OK. I hope you get some value out of these samples all the same.

Best,
Kent

youiandreactiveui's People

Contributors

ghuntley avatar henningms avatar kentcb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youiandreactiveui's Issues

System.NullReferenceException when trying to use the twitter client.

I am getting the following exception when I run the twitter client:

System.NullReferenceException: Object reference not set to an instance of an object.
at Tweetinvi.Logic.JsonConverters.JsonLanguageConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Tweetinvi.Logic.JsonConverters.JsonPropertyConverterRepository.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, 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.Serialization.JsonSerializerProxy.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
at Tweetinvi.Logic.JsonConverters.JsonInterfaceToObjectConverter2.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) at Tweetinvi.Logic.JsonConverters.JsonPropertyConverterRepository.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, 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.Serialization.JsonSerializerProxy.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader) at Tweetinvi.Logic.JsonConverters.JsonInterfaceToObjectConverter2.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, 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.Serialization.JsonSerializerProxy.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
at Tweetinvi.Logic.JsonConverters.JsonInterfaceToObjectConverter2.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, 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(String value, Type type, JsonConverter[] converters) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonConverter[] converters) at Tweetinvi.Logic.Wrapper.JsonConvertWrapper.DeserializeObject[T](String json, JsonConverter[] converters) at Tweetinvi.Logic.JsonConverters.JsonObjectConverter.DeserializeObject[T](String json, JsonConverter[] converters) at Tweetinvi.Credentials.TwitterAccessor.ExecuteGETQuery[T](String query, JsonConverter[] converters) at Tweetinvi.Controllers.Search.SearchQueryExecutor.GetSearchTweetResultsFromQuery(String query) at Tweetinvi.Controllers.Search.SearchQueryExecutor.SearchTweetsWithMetadata(ISearchTweetsParameters searchTweetsParameters) at Tweetinvi.Controllers.Search.SearchQueryExecutor.SearchTweets(ISearchTweetsParameters searchTweetsParameters) at Tweetinvi.Controllers.Search.SearchController.SearchTweets(ISearchTweetsParameters searchTweetsParameters) at Tweetinvi.Search.SearchTweets(ISearchTweetsParameters searchTweetsParameters) at Book.ViewModels.Samples.Chapter02.Sample02.MainViewModel.<>c__DisplayClass46_0.<GetTweets>b__0() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

I have pasted in the keys from twitter. Twitter says my access token has read and write access level.

Chapter 02, Sample 02: 'Twitter Client' - an issue within `ReactiveUI.ReactiveList` is causing an exception

I just started reading this excellent book (superb job Kent, really), as someone completely new to Reactive Extensions (I've read the primer twice and introtorx.com docs) and especially to ReactiveUI, I was a bit disenchanted by an ugly exception thrown at me while scrolling the tweets in a twitter client showcase.

System.NotSupportedException
  HResult=0x80131515
  Message=Range actions are not supported.
  Source=PresentationFramework
  StackTrace:
   at System.Windows.Data.ListCollectionView.ValidateCollectionChangedEventArgs(NotifyCollectionChangedEventArgs e)
   at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at ReactiveUI.ReactiveList`1.raiseCollectionChanged(NotifyCollectionChangedEventArgs args) in C:\projects\reactiveui\src\ReactiveUI\ReactiveList.cs:line 44
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
   at System.Reactive.Linq.ObservableImpl.Where`1._.OnNext(TSource value)
   at System.Reactive.Observer`1.OnNext(T value)
   at System.Reactive.Subjects.Subject`1.OnNext(T value)
   at ReactiveUI.ReactiveList`1.AddRange(IEnumerable`1 collection) in C:\projects\reactiveui\src\ReactiveUI\ReactiveList.cs:line 360

This happens after the 5h 'page' of tweets loaded via the scrollbar.

At this point, the reader isn't supposed to looking at the code let alone debug it, which is exactly what I did as the curiosity got the best of me :).

As it turns out, after some researching I found that the issue is already reported in reactiveui/ReactiveUI#1354 and it resulted in actual deprecation of the faulting method ReactiveList.AddRange.

After doing a little bit more research I was able to find this nice page where the matter is explained in greater detail:
ReactiveUI is deprecating ReactiveList

If you read that page you'll notice that a replacement is being offered, a library called DynamicData. It is an open-source library that further extends ReactiveUI offering the exact kind of real-time updates a software such as a Twitter Client would need to elegantly process new data, updates, deletions, filtering, etc. I just happen to know about this library, prior to even ordering the book, seeing as such concerns were exactly the ones I was hoping to solve with ReactiveUI so I stumbled upon it as well as this lovely book.

Now, I believe that the original Twitter Client may work just fine with some minor fixing (i.e. not using AddRange) but at this point I'm not qualified to really give any real advice.

Anyways, I just want to say that I'm amazed at the quality of the book (and the samples)! This was just a minor inconvenience that was too tempting for me not to open up the hood.

Memory leak in the sample app

Thank you very much for writing the book and the beautiful sample app. While running the sample app, I noticed that memory usage doesn't go down. Are you aware of that? Is it because of navigation stack? Can we prevent it in a ReactiveUI app?

Here is a video showing the memory leak:
https://www.youtube.com/watch?v=1osCENxFN4g

Note: Sample (32 bit) is the YouIandReactiveUI sample app.

#24 Testing

Hello Kent,

first of all I want to say thank you for this awesome book that really helps wrapping my head around ReactiveUI and vastly improving my MVVM experience.

I am almost through, but got a bit stuck on Chapter 24 - Testing, more specifically the accompanying code.

I have never worked with xUnit before so I was a bit puzzled how to run the tests as "run all" in the test explorer didn't work (tests were discovered but not run). After adding the nuget packages "xunit.runner.visualstudio" and "Microsoft.NET.Test.Sdk" to the ViewModels project it now works as expected. Is there any other way to run these tests as the packages are not included in the repo?

Another issue are the tests called memory_is_reclaimed_after_deactivation(). They are all failing for me. The source code comment says
IMPORTANT: if you're observing failures in this test, try running it in release mode without a debugger attached.
I am doing that but still get a fail at Assert.True(weakSut.IsAlive)
What could I be doing wrong?

Best regards,
Markus

EBook

I live in an out-of-the-way place and shipping books is a huge pain. Can I buy an eBook version anywhere?

Sample Code doesn't compile...

Hi Kent,

I just paid $67.49 plus shipping to Blurb.com for your book. Got your book, started to read, follow your instructions. Got the source code - cannot compile. A lot of interfaces and classes not found (IReactiveDerivedList, ReactiveList, etc.). I know you wrote this book for version 8 of ReactiveUI and I expected the changes in the framework and I understand that making new edition of the book is too much to ask. But the source code? You are the expert in ReactiveUI, how hard it is for you to load the source, comment out the code what is obsolete, replace it with new classes and interfaces, put a comment why you did it.
At the current state, for programmers like myself, who is trying to learn ReactiveUI your book is useless. First of all: why anyone would like to learn an obsolete concepts without clear path how to move forward (a working source code could do the job). Second: first impression of the ReactiveUI framework that it is changing to much and maintain source code will be a nightmare for the long run enterprise projects.
Third: You have a good looking book, well though through, well organized and may be very useful for an experience ReactiveUI programmer, but for a beginner => zero utility value.
Please do not take my comment in a wrong way. Just, I feel like a child who got a toy what he was waiting for so long, finally it came, but batteries was not included...

Thank you,
Michael.

Trying to open book files in VS2022 on a brand new machine

Hi all,
I'm trying to open the book files on a new computer that has vs2022 and it's saying i need .net 471 but when i try to install it it says .net 471 is already installed on this computer. And when i try to upgrade to .net 4.8 i get a bunch of errors. Any ideas?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.