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

Passing invalid URI to Fetch method does not throws an exception to catch block.

Open piyush965 opened this issue 8 years ago • 3 comments

Environment

  1. react-native -v: 0.55
  2. npm ls rnpm-plugin-windows:
  3. npm ls react-native-windows:
  4. node -v:
  5. npm -v:
  6. yarn --version:

Then, specify:

  • Target Platform: UWP, WPF
  • Target Platform Version(s): UWP, .NET 4.6.1
  • Target Device(s): Desktop, Tablet
  • Development Operating System: 10
  • Visual Studio Version: 2017
  • Build Configuration: Debug

Steps to Reproduce

Passing invalid URI (ex - !@#$) to Fetch method does not throws an exception to catch block instead red screen appeared. Exception occurred at IReflectionReactDelegateFactory.cs file Line no 135 - NativeArgumentsParseException.

Sample failure mode code:

`import React from 'react'; import { FlatList, ActivityIndicator, Text, View } from 'react-native';

export default class FetchExample extends React.Component { constructor(props){ super(props); this.state ={ isLoading: true} }

componentDidMount(){ return fetch('https://!@#facebook.github.io/react-native/movies.json') .then((response) => response.json()) .then((responseJson) => {

    this.setState({
      isLoading: false,
      dataSource: responseJson.movies,
    }, function(){

    });

  })
  .catch((error) =>{
    console.error(error);
  });

}

render(){

if(this.state.isLoading){
  return(
    <View style={{flex: 1, padding: 20}}>
      <ActivityIndicator/>
    </View>
  )
}

return(
  <View style={{flex: 1, paddingTop:20}}>
    <FlatList
      data={this.state.dataSource}
      renderItem={({item}) => <Text>{item.title}, {item.releaseYear}</Text>}
      keyExtractor={(item, index) => index}
    />
  </View>
);

} } `

Expected Behavior

I expect passing invalid URI to Fetch method should throw an exception to catch block.

Actual Behavior

Red screen is appeared.

Reproducible Demo

Refer above sample failure mode code.

piyush965 avatar Jul 11 '18 17:07 piyush965

Looks like this is a issue in react native https://github.com/facebook/react-native/issues/7436

howlettt avatar Jul 22 '18 23:07 howlettt

It's been fixed upstream, we should pull in the relevant fix: https://github.com/facebook/react-native/pull/18103/files

matthargett avatar Sep 17 '18 19:09 matthargett

We are not investing in new features or lower priority bug fixes on vCurrent. The bulk of investment is now in vNext as we prepare to make that the default choice. If this issue is still relevant on the vNext implementation please open a vNext issue. If this issue is of significant severity for a vCurrent app and vNext is not an option, re-open with justification.

ghost avatar Oct 25 '19 21:10 ghost