Skip to content

- add new API and keep existing API

79b4e05
Select commit
Loading
Failed to load commit list.
Draft

[browser] avoid reflection on JSExport #122024

- add new API and keep existing API
79b4e05
Select commit
Loading
Failed to load commit list.
Build Analysis / Build Analysis failed Nov 28, 2025 in 0s

.NET Result Analysis

Details

Tip

To unconditionally bypass the build analysis check (turn it green), you can use the escape mechanism feature. The completion time may vary, potentially taking several minutes, depending on the build analysis workload at the moment.

Build Failures

runtime / Build / browser-wasm linux Release MultiThreaded_BuildOnly / Build product

[ 🚧 Report infrastructure issue] [ 📄 Report repository issue]
    ❌src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs(314,32): error CS8602: Dereference of a possibly null reference.
    ❌src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSHostImplementation.cs(349,32): error CS8602: Dereference of a possibly null reference.

runtime / Build / browser-wasm windows Release MultiThreaded_BuildOnly / Build product

[ 🚧 Report infrastructure issue] [ 📄 Report repository issue]
    ❌src\libraries\System.Runtime.InteropServices.JavaScript\src\System\Runtime\InteropServices\JavaScript\JSHostImplementation.cs(314,32): error CS8602: Dereference of a possibly null reference.
    ❌src\libraries\System.Runtime.InteropServices.JavaScript\src\System\Runtime\InteropServices\JavaScript\JSHostImplementation.cs(349,32): error CS8602: Dereference of a possibly null reference.

Test Failures (30 tests failed)

🔹 [All failing tests from runtime]

    ⚠️ 28 failing tests not displayed for this pipeline due to space limitations

    JSImportGenerator.Unit.Tests.Compiles.ValidateGeneratedSourceOutput_AllAnnotatedParameters [Console] [Details] [Artifacts] [0.16% failure rate]
    [ 🚧 Report test infrastructure issue] [ 📄 Report test repository issue]

    Failing Configurations (15)

    Exception Message
    System.InvalidOperationException : Context: Source generator application
    Context: Verifying source generated files
    content of 'Microsoft.Interop.JavaScript.JSImportGenerator/Microsoft.Interop.JavaScript.JSExportGenerator/JSExports.g.cs' did not match. Diff shown with expected as baseline:
     // <auto-generated/>
     namespace System.Runtime.InteropServices.JavaScript
     {
         [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute]
         unsafe class __GeneratedInitializer
         {
             [global::System.ThreadStaticAttribute]
             static bool initialized;
             [global::System.Runtime.CompilerServices.ModuleInitializerAttribute, global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods, "System.Runtime.InteropServices.JavaScript.__GeneratedInitializer", "TestProject")]
             static internal void __TrimmingPreserve_()
             {
             }
    
         static void &#95;&#95;Register&#95;&#40;&#41;
         {
             if &#40;initialized || global::System.Runtime.InteropServices.RuntimeInformation.OSArchitecture != global::System.Runtime.InteropServices.Architecture.Wasm&#41;
                 return;
             initialized = true;
    
    •        global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction&#40;Basic.&#95;&#95;Wrapper&#95;AnnotatedExport&#95;1583225186 ,&#34;AnnotatedExport&#34;, 1583225186, &#91;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Discard, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Action&#40;&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Function&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Span&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.ArraySegment&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Byte&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Array&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTime&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.DateTimeOffset&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64&#41;&#93;&#41;;
      
    •        global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction&#40;Basic.&#95;&#95;Wrapper&#95;AnnotatedExport&#95;1583225186, &#34;AnnotatedExport&#34;, 1583225186, &#91;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Discard, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Object, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int52, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.BigInt64, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Action&#40;&#41;, global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Function&#40;global:</pre></dd>
      
      CallStack
         at Microsoft.CodeAnalysis.Testing.DefaultVerifier.Fail(String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/DefaultVerifier.cs:line 105
       at Microsoft.CodeAnalysis.Testing.IVerifierExtensions.EqualOrDiff(IVerifier verifier, String expected, String actual, String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/Extensions/IVerifierExtensions.cs:line 67
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].<VerifySourceGeneratorAsync>g__VerifyDocuments|66_0(IVerifier verifier, ImmutableArray`1 actualDocuments, ImmutableArray`1 expectedDocuments, Boolean allowReordering, String defaultFilePathPrefix, Func`3 getNameAndFolders, TimeSpan matchTimeout) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 421
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.<VerifySourceGeneratorAsync>d__66[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext() in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 313
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.<VerifySourceGeneratorAsync>d__65[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext() in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 268
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.<RunImplAsync>d__62[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext() in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 202
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.<RunAsync>d__61[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext() in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 172
       at JSImportGenerator.Unit.Tests.Compiles.ValidateGeneratedSourceOutput_AllAnnotatedParameters() in /_/src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/Compiles.cs:line 269
      

    --- End of stack trace from previous location ---

    JSImportGenerator.Unit.Tests.Compiles.ValidateGeneratedSourceOutput_Return [Console] [Details] [Artifacts] [0.16% failure rate]
    [ 🚧 Report test infrastructure issue] [ 📄 Report test repository issue]

    Failing Configurations (15)

    Exception Message
    System.InvalidOperationException : Context: Source generator application
    Context: Verifying source generated files
    content of 'Microsoft.Interop.JavaScript.JSImportGenerator/Microsoft.Interop.JavaScript.JSExportGenerator/JSExports.g.cs' did not match. Diff shown with expected as baseline:
     // <auto-generated/>
     namespace System.Runtime.InteropServices.JavaScript
     {
         [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute]
         unsafe class __GeneratedInitializer
         {
             [global::System.ThreadStaticAttribute]
             static bool initialized;
             [global::System.Runtime.CompilerServices.ModuleInitializerAttribute, global::System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods, "System.Runtime.InteropServices.JavaScript.__GeneratedInitializer", "TestProject")]
             static internal void __TrimmingPreserve_()
             {
             }
    
         static void &#95;&#95;Register&#95;&#40;&#41;
         {
             if &#40;initialized || global::System.Runtime.InteropServices.RuntimeInformation.OSArchitecture != global::System.Runtime.InteropServices.Architecture.Wasm&#41;
                 return;
             initialized = true;
    
    •        global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction&#40;Basic.&#95;&#95;Wrapper&#95;Export1&#95;622134597 ,&#34;Export1&#34;, 622134597, &#91;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32&#41;&#93;&#41;;
      
    •        global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding.BindManagedFunction&#40;Basic.&#95;&#95;Wrapper&#95;Export1&#95;622134597, &#34;Export1&#34;, 622134597, &#91;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Task&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerType.Int32&#41;&#93;&#41;;
         }
      
      }
      }
      unsafe partial class Basic
      {
      [global::System.Diagnostics.DebuggerNonUserCode]
      public static unsafe void __Wrapper_Export1_622134597(global::System.IntPtr __arguments_ptr)
      {
    •    var &#95;&#95;arguments&#95;buffer = &#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument&#42;&#41; &#95;&#95;arguments&#95;ptr;
      
    •    global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument&#42; &#95;&#95;arguments&#95;buffer = &#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument&#42;&#41;&#95;&#95;arguments&#95;ptr;
         &#95;&#95;Stub&#40;&#95;&#95;arguments&#95;buffer, &#95;&#95;arguments&#95;buffer + 1&#41;;
         &#91;global::System.Diagnostics.DebuggerNonUserCode&#93;
         void &#95;&#95;Stub&#40;global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument&#42; &#95;&#95;&#95;&#95;arg&#95;exception&#95;native&#95;&#95;param, global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument&#42; &#95;&#95;invokeRetValUnmanaged&#95;&#95;param&#41;
         {
             ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument &#95;&#95;&#95;&#95;arg&#95;exception&#95;native = ref &#42;&#95;&#95;&#95;&#95;arg&#95;exception&#95;native&#95;&#95;param;
             ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument &#95;&#95;invokeRetValUnmanaged = ref &#42;&#95;&#95;invokeRetValUnmanaged&#95;&#95;param;
             global::System.Threading.Tasks.Task&#60;int&#62; &#95;&#95;invokeRetVal = default;
             try
             {
                 &#95;&#95;invokeRetVal = global::Basic.Export1&#40;&#41;;
                 // Marshal - Convert managed data to native data.
                 &#95;&#95;invokeRetValUnmanaged.ToJS&#40;&#95;&#95;invokeRetVal, static &#40;ref global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument &#95;&#95;task&#95;result&#95;arg, int &#95;&#95;task&#95;result&#41; =&#62;
                 {
                     &#95;&#95;task&#95;result&#95;arg.ToJS&#40;&#95;&#95;task&#95;result&#41;;
                 }&#41;;
             }
             catch &#40;global::System.Exception &#95;&#95;arg&#95;exception&#41;
             {
                 &#95;&#95;&#95;&#95;arg&#95;exception&#95;native.ToJS&#40;&#95;&#95;arg&#95;exception&#41;;
             }
         }
      
      }
      }

    CallStack
       at Microsoft.CodeAnalysis.Testing.DefaultVerifier.Fail(String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/DefaultVerifier.cs:line 105
       at Microsoft.CodeAnalysis.Testing.IVerifierExtensions.EqualOrDiff(IVerifier verifier, String expected, String actual, String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/Extensions/IVerifierExtensions.cs:line 67
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].<VerifySourceGeneratorAsync>g__VerifyDocuments|66_0(IVerifier verifier, ImmutableArray`1 actualDocuments, ImmutableArray`1 expectedDocuments, Boolean allowReordering, String defaultFilePathPrefix, Func`3 getNameAndFolders, TimeSpan matchTimeout) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 421
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.<VerifySourceGeneratorAsync>d__66[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext() in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 313
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.<VerifySourceGeneratorAsync>d__65[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext() in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 268
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.<RunImplAsync>d__62[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext() in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 202
       at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.<RunAsync>d__61[[Microsoft.CodeAnalysis.Testing.DefaultVerifier, Microsoft.CodeAnalysis.Analyzer.Testing, Version=1.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].MoveNext() in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 172
       at JSImportGenerator.Unit.Tests.Compiles.ValidateGeneratedSourceOutput_Return() in /_/src/libraries/System.Runtime.InteropServices.JavaScript/tests/JSImportGenerator.UnitTest/Compiles.cs:line 391
    --- End of stack trace from previous location ---

Was this helpful? Yes No