question

ChanumoluBalaNaren-1089 avatar image
0 Votes"
ChanumoluBalaNaren-1089 asked ·

Why "System.Environment.GetFolderPath(SpecialFolder)" method is not found during run time?

Hi,

I have a Progressive Web App(Universal Windows) which uses a Windows Runtime Component(Universal Windows). This Windows Runtime Component(Universal Windows) uses a .Net Standard library(.dll).

Properties of Progressive Web App(Universal Windows):
3801-5.png


After running Progressive Web App(Universal Windows), a button appears and when we click this button below code snippet executes in which a method from Windows Runtime Component(Universal Windows) is called.

 function onClickbtn()
 {
   var strPath=WinMDComponent.WinMDComp.getPath();
 }

In Windows Runtime Component(Universal Windows) project i have the below code which calls a method from the .Net Standard library:

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
    
 namespace WinMDComponent
 {
     public sealed class WinMDComp
     {
         public static string getPath()
         {
             return NetStandard2Component.NetStand2Comp.getDataPath();
         }
     }
 }

in .Net Standard project i have the below code:

 using System;
    
 namespace NetStandard2Component
 {
     public class NetStand2Comp
     {
         public static string getDataPath()
         {
             return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
         }
     }
 }

Problem Description:

1.If i keep the minimum version of Windows Runtime Component(Universal Windows) project as 10240 (Target Version is always 16299) , i had to add "netstandard.dll" as a reference in Windows Runtime Component(Universal Windows) project and after running Progressive Web App(Universal Windows) project i got below error

3811-one.png


2.If i keep the minimum version of Windows Runtime Component(Universal Windows) project as 16299 (Target Version is always 16299) , i don't need to add "netstandard.dll" as a reference in Windows Runtime Component(Universal Windows) project and if run Progressive Web App(Universal Windows) project i got below error:

3821-2.png



Can anyone help me to solve this problem?

windows-uwpwindows-uwp-runtime
5.png (5.0 KiB)
one.png (17.7 KiB)
2.png (10.8 KiB)
· 4
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, Environment.GetFolderPath() was introduced in version 15138 and is currently only available for 16299 and above. You get an error at run time, probably due to a problem with the calling process. Can you provide a minimum runnable demo so that I can better analyze your problem?

0 Votes 0 ·

I have received your project and reproduced this problem, I am contacting the relevant engineers, if there is new progress, I will post here

0 Votes 0 ·

Hello, sorry for the late reply. After testing by engineers, the problem was reproduced in debug mode. We are still exploring deeper reasons. According to the engineer's suggestion, you can consider using C++ runtime components in the project, or see if the event can be triggered normally in Release mode.

0 Votes 0 ·

0 Answers