react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Fetching Image resource causes repeated System.ArgumentException

Open pre10der89 opened this issue 9 years ago • 4 comments

A System.ArgumentException is seen when fetching an image... The image is eventually loaded...

It appears that there may be a bind failure in some reflection method call as assumed by the statement on the top of the stack...

Near the bottom of the stack is a reference to:

ReactNative.Modules.Image.ImageStatusEventData

This is the stack trace

mscorlib.dll!System.Delegate.CreateDelegate(System.Type type, object firstArgument, System.Reflection.MethodInfo method, bool throwOnBindFailure)	Unknown
mscorlib.dll!System.Delegate.CreateDelegate(System.Type type, object firstArgument, System.Reflection.MethodInfo method)	Unknown
System.Reactive.dll!System.Reactive.ReflectionUtils.CreateDelegate<System.EventHandler<System.Windows.Media.Imaging.DownloadProgressEventArgs>>(object o, System.Reflection.MethodInfo method)	Unknown
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.FromEventPattern.Impl<System.EventHandler<System.Windows.Media.Imaging.DownloadProgressEventArgs>, System.Net.DownloadProgressChangedEventArgs>.GetHandler(System.Action<System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>> onNext)	Unknown
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.EventProducer<System.EventHandler<System.Windows.Media.Imaging.DownloadProgressEventArgs>, System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>>.Session.Initialize()	Unknown
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.EventProducer<System.EventHandler<System.Windows.Media.Imaging.DownloadProgressEventArgs>, System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>>.Session.Connect(System.IObserver<System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>> observer)	Unknown
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.EventProducer<System.EventHandler<System.Windows.Media.Imaging.DownloadProgressEventArgs>, System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>>.Run(System.IObserver<System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>> observer, System.IDisposable cancel, System.Action<System.IDisposable> setSink)	Unknown
System.Reactive.dll!System.Reactive.Producer<System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>>.SubscribeRaw(System.IObserver<System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>> observer, bool enableSafeguard)	Unknown
System.Reactive.dll!System.Reactive.Producer<System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>>.SubscribeRaw(System.IObserver<System.Reactive.EventPattern<System.Net.DownloadProgressChangedEventArgs>> observer, bool enableSafeguard)	Unknown
System.Reactive.dll!System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.Run(System.Reactive.Concurrency.IScheduler _, System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.State x)	Unknown
System.Reactive.dll!System.Reactive.Concurrency.ScheduledItem<System.TimeSpan, System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.State>.InvokeCore()	Unknown
System.Reactive.dll!System.Reactive.Concurrency.CurrentThreadScheduler.Trampoline.Run(System.Reactive.Concurrency.SchedulerQueue<System.TimeSpan> queue)	Unknown
System.Reactive.dll!System.Reactive.Concurrency.CurrentThreadScheduler.Schedule<System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.State>(System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.State state, System.TimeSpan dueTime, System.Func<System.Reactive.Concurrency.IScheduler, System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.State, System.IDisposable> action)	Unknown
System.Reactive.dll!System.Reactive.Concurrency.LocalScheduler.Schedule<System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.State>(System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.State state, System.Func<System.Reactive.Concurrency.IScheduler, System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.State, System.IDisposable> action)	Unknown
System.Reactive.dll!System.Reactive.Producer<ReactNative.Modules.Image.ImageStatusEventData>.SubscribeRaw(System.IObserver<ReactNative.Modules.Image.ImageStatusEventData> observer, bool enableSafeguard)	Unknown
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.Merge<ReactNative.Modules.Image.ImageStatusEventData>.Observables._.OnNext(System.IObservable<ReactNative.Modules.Image.ImageStatusEventData> value)	Unknown
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.ToObservable<System.IObservable<ReactNative.Modules.Image.ImageStatusEventData>>._.Loop(System.Collections.Generic.IEnumerator<System.IObservable<ReactNative.Modules.Image.ImageStatusEventData>> enumerator, System.Reactive.Disposables.ICancelable cancel)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown

pre10der89 avatar Jul 21 '17 20:07 pre10der89

this is the component source that triggers these first/second chance exceptions when the mouseover is done on the 'stars'. nothing special:

import React, { Component, PropTypes } from 'react'
import { View, TouchableOpacity, Text, Image } from 'react-native'
import { Images } from '~/Themes'
import Styles from './Styles/FiveStarRatingStyles'

export default class FiveStarRating extends Component {
  static propTypes = {
    closeFeedbackContainer: PropTypes.func
  }

  constructor (props) {
    super(props)
    this.state = {
      hover: false
    }
  }

  handlePressOnStar (e, index) {
    this.props.closeFeedbackContainer(index)
  }

  renderStar = (index, filled) => {
    const { hover } = this.state
    return (
      <View style={Styles.star} onMouseEnter={() => this.setState({hover: index})}>
        <TouchableOpacity onPress={(e) => this.handlePressOnStar(e, index)}>
          <Image source={hover && hover >= index ? Images.ratingStarFilled : Images.ratingStar} style={Styles.starImage} />
        </TouchableOpacity>
      </View>
    )
  }

  render () {
    return (
      <View style={Styles.container}>
        <View style={Styles.starContainer} onMouseLeave={() => this.setState({hover: false})}>
          {this.renderStar(1)}
          {this.renderStar(2)}
          {this.renderStar(3)}
          {this.renderStar(4)}
          {this.renderStar(5)}
        </View>
        <View style={Styles.ratingContainer}>
          <Text style={Styles.ratingText}>Bad</Text>
          <Text style={Styles.ratingText}>Great!</Text>
        </View>
      </View>
    )
  }
}

pre10der89 avatar Jul 21 '17 20:07 pre10der89

@pre10der89 still an issue?

rozele avatar Jul 23 '18 21:07 rozele

Attaching Example for reference

RNWIssue1222.zip

pre10der89 avatar Jul 24 '18 00:07 pre10der89

@rozele I'm not able to update my project to 55 so not sure if it still exists there. I uploaded a sample application with a hover trigger to switch the image on mouse enter/leave that I was expecting to show the issue. I'm going to close this assuming that the upgrade of System.Reactive fixed this.

pre10der89 avatar Jul 24 '18 00:07 pre10der89