-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
App certification fails with a custom C# native module #4516
Comments
@giregk Based on the breadth of apps hitting this (thank you for the links), this seems like a UWP or Visual Studio issue that isn't specific to RNW. The dotnet/runtime issue seems closest to the source. So you're saying updating that version to 6.2.2 did not resolve this? If not you may want to ping that issue or open a new one. We'd be happy to help find eyeballs to look at this. Just for context, what is the scope of the C# module you're implementing? Or did this repro on essentially a blank module? |
@chrisglein thank you for your answer. My C# project currently uses version 6.2.9 of Microsoft.NETCore.UniversalWindowsPlatform. (The fix in the post is to upgrade to 6.2.2, so I assume that later versions would still be OK, though I haven't tested to use exactly version 6.2.2). I agree it seems like a UWP or Visual Studio issue, but I thought maybe it could also come from some outdated dependency or specific configuration in react-native-windows. I guess if it doesn't ring a bell to you, it means the answer is elsewhere. I'll keep looking and/or open an new issue and keep you updated. My module is a bridge to some Windows.Security.Cryptography and Windows.Security.Credentials APIs. |
I'm a beginer with Visual Studio, so I've just understood now what "removing Microsoft.NETCore.Portable.Compatibility" meant! (a suggested fix from one of the above links) If I open the menu tools > NuGet Package Manager > Manage NuGet Packages for solution > Installed tab then select Microsfot.NETCore.UniversalWindowsPlatform, in the dependencies section, I see this So it looks like my project is using this bad Microsoft.NETCore.Portable.Compatibility. My question now is do you know how I remove it ? ==== |
I have made a demo project to test this issue with a virgin project. So I do get an error with a very simple C# module that exposes the I also opened an issue in the dotnet/runtime repo |
I can't wait for this issue to be fixed, so I've rewritten my module in C++ (much simpler than I expected by the way). I suggest the documentation on C# native modules be updated to highlight the fact that they prevent apps from being published so other developers don't waste time like I did. |
Also, thank you @giregk for trying so hard on this one and doing everything right. Our response time is a bit slow right now :(. I'm glad you're unblocked with the C++ module. We'll get to the bottom of this. |
@giregk sounds like you would run into this if you tried publishing the debug build of the C# app. You can only publish UWP apps to the store that have gone through the .net native toolchain. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 14 days of this comment. |
Hello @asklar Sorry for my late response, I totally forgot about your comment. What do you mean by "going through the .net native toolchain" ? Is there a specific action I need to do ? I've reopened my example project and made sure that all projects in the solution are built with the Release config, including the C# one. But I still get the same certification error. I'm not an expert with visual studio at all, so I'm must be doing something wrong. |
@giregk Make sure that you are trying to submit a Release build (not Debug) and that the Use .net native toolchain option is selected for Release: |
@asklar I don't have the same configuration. Here is what I see |
@giregk I'm looking into this with the project you posted - thanks for that - and I'm able to see the failure from WACK you reported: Stay tuned... |
@giregk I was able to fix the clrcompression failures. The trick is to ensure your native project cross-compiles the C# code onto native since only full native code can be accepted to the store. The cross-compilation / ahead-of-time compilation technology is called .net native. I wrote a sample on how to access a C# UWP component from a C++ UWP app a few months ago, here: https://github.com/asklar/winrtcomponent Basically what you're missing in your solution is: <PropertyGroup>
<UseDotNetNativeToolchain Condition="'$(Configuration)'=='Release'">true</UseDotNetNativeToolchain>
<DotNetNativeVersion>2.2.3</DotNetNativeVersion>
</PropertyGroup> c) Set your project min version to be >17134 After doing all that I can create a package and the clrcompression WACK failures are fixed. |
@giregk to verify that everything would work without v8JSI, I then went ahead and removed the references to link in v8jsi.dll (which is not needed), rebuilt the package and re-ran WACK and now it passes. |
thanks @asklar ! I merged your PR and tried to run the project, but I now get the following error:
I still don't see the 'Compile with .net native toolchain' parameter in the C# project properties. I unfortunately don't have the time to investigate this further, but I guess I could find the answers on the web now that I know I need to compile the C# code. The main problem here is probably that my environment is not properly setup for C# projects / I don't have enough background about C# development. Before this project, I had never used Visual Studio and had never used C++, nor C#, nor .NET. The documentation should perhaps guide developpers coming from a js background (like myself) how to setup a visual studio environment from scratch. Especially in preamble of the react-native-windows C# native modules documentation where some knowledge about UWP deployment and C# compiling is required and not explained. I'll mark this issue as resolved because you were able to fix it. Next time I need to use a C# native module, I'll now where to start from. Again, thank you a lot @asklar for taking the time to look into this. |
I had the exact same issue and was able to fix it with this solution. This helped me to successfully submit my app submission on the microsoft store. Yet, After applying this fix I cannot run my app in, by clicking the Play Ion (Local Machine) anymore. It crashes with: Exception thrown at 0x00007FFDE86A3E49 (KernelBase.dll) in cateurope.exe: WinRT originate error - 0x80131522 : 'System.TypeLoadException: Could not load type 'Internal.Runtime.Augments.EnvironmentAugments' from assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. After reverting the changes suggested in this solution. The app starts building just fine. Any ideas? |
@exotexot Ack, that's frustrating. So close to it working! Can you open a new issue that captures your environment so we can help figure this out? |
Drop [react-native-windows] folder from [node-modules] and relaunch npm install. |
Environment
react-native -v:
react-native-cli: 2.0.1
react-native: 0.61.5
react-native run-windows --info:
System:
OS: Windows 10 10.0.18362
CPU: (4) ia32 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Memory: 2.98 GB / 7.92 GB
Binaries:
Node: 12.1.0 - C:\Program Files (x86)\nodejs\node.EXE
Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.9.0 - C:\Program Files (x86)\nodejs\npm.CMD
npmPackages:
react: 16.9.0 => 16.9.0
react-native: ^0.61.5 => 0.61.5
react-native-windows: 0.61.0 => 0.61.0
rnpm-plugin-windows: ^0.5.1-0 => 0.5.1-0
Installed UWP SDKs:
10.0.14393.0
10.0.17763.0
10.0.18362.0
Steps to Reproduce
Expected Behavior
The project should pass the certification test.
Actual Behavior
Certification report has an "Supported API test" issue
Additional context
The only references to clrcompression are in the build outputs of that custom native C# project. I don't find any references to that in the react-native-windows folder.
I found those links but could not make those fixes work in my projects
I'd like to avoid having to rewrite my module in C++ if possible.
The text was updated successfully, but these errors were encountered: