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

Problem running first time - exception in reactnative.dll

Open KalKhera opened this issue 10 years ago • 5 comments

Sorry all, Hope this is a familiar problem as follows.

'FontFamily.XamlAutoFontFamily' threw an exception of type 'System.InvalidCastException' in reactnative.dll

{"Unable to cast object of type 'System.__ComObject' to type 'Windows.UI.Xaml.Media.IFontFamilyStatics2'."}

Stack trace at System.StubHelpers.StubHelpers.GetCOMIPFromRCW_WinRT(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget) at Windows.UI.Xaml.Media.FontFamily.get_XamlAutoFontFamily() at ReactNative.Views.Text.ReactTextShadowNode.UpdateTextBlockCore(RichTextBlock textBlock, Boolean measureOnly) at ReactNative.Views.Text.ReactTextShadowNode.<>c__DisplayClass20_0.b__0() at ReactNative.Bridge.DispatcherHelpers.<>c__DisplayClass3_0`1.b__0()

Node version 5.3.0 Npm v3.3.12

Microsoft Visual Studio Enterprise 2015 Version 14.0.25425.01 Update 3 Microsoft .NET Framework Version 4.6.01055 Installed Version: Enterprise Architecture and Modeling Tools 00322-80000-00000-AA533 Microsoft Architecture and Modeling Tools

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015 00322-80000-00000-AA533 Microsoft Visual Basic 2015

Visual C# 2015 00322-80000-00000-AA533 Microsoft Visual C# 2015

Visual C++ 2015 00322-80000-00000-AA533 Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package 7.1.00719.1 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015 (RC1 Update 1) 14.1.20203.0 ASP.NET and Web Tools 2015 (RC1 Update 1)

ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0 For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.40314.0 For additional information, visit http://www.asp.net/

Azure App Service Tools v2.9.1 14.0.20622.0 Azure App Service Tools v2.9.1

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.0.6000.0 Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools 1.8 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Devart dotConnect for Oracle 8.5.602.0 Devart dotConnect for Oracle Copyright 2002 - 2016 Devart. All rights reserved. Web: www.devart.com/dotconnect/oracle Support: [email protected]

Devart Entity Developer 5.8.803.0 Devart Entity Developer Copyright © 2008-2016 Devart. All rights reserved. Web: www.devart.com/entitydeveloper Support: [email protected]

JavaScript Language Service 2.0 JavaScript Language Service

JavaScript Project System 2.0 JavaScript Project System

JetBrains ReSharper Ultimate 2015.2 Build 103.0.20150818.200216 JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2016 JetBrains, Inc.

Microsoft Azure HDInsight HQL Service 2.0.6000.0 Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio 2.0.6000.0 An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools 1.4 Microsoft Azure Mobile Services Tools

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.9.40701.9

Reactnative.dll runtime version v4.0.30319 Version 1.0.0.0

NuGet Package Manager 3.4.4 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools 14.0.60519.0 Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript 1.8.36.0 TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps 14.0.25527.01 The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

project package.json

{ "name": "Tute", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { "react": "15.2.1", "react-native": "0.30.0", "react-native-windows": "^0.30.0" }, "devDependencies": { "rnpm-plugin-windows": "^0.1.1" } }

KalKhera avatar Aug 05 '16 04:08 KalKhera

@ebragge you had seen this issue before hadn't you? Any info on how you resolved?

rozele avatar Aug 05 '16 13:08 rozele

Hello guys commenting the offending line - seemed to fix the problem, not sure of proper resolution, your input would be appreciated,

private void UpdateTextBlockCore(RichTextBlock textBlock, bool measureOnly) { ... // textBlock.FontFamily = _fontFamily != null ? new FontFamily(_fontFamily) : //FontFamily.XamlAutoFontFamily; ... }

KalKhera avatar Aug 08 '16 05:08 KalKhera

@KalKhera which Windows 10 version are you running 10240, 10586 etc. ? @rozele when I had the problem I did the same as KalKhera (just commenting out the lines) since I was thinking that the problem was related to Windows 10 version, I was running 10240 at that time. I haven't revisited the problem since.

ebragge avatar Aug 08 '16 08:08 ebragge

@KalKhera a better solution would be to replace all references to FontFamily.XamlAutoFontFamily with new FontFamily("Segoe UI"). These expressions are basically equivalent.

rozele avatar Aug 08 '16 15:08 rozele

Thanks folks, I was running build 10240, upgraded to 10586 and issue is solved, no need for commenting code.

KalKhera avatar Aug 09 '16 04:08 KalKhera