Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8735935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:11:11+00:00 2026-06-13T10:11:11+00:00

I have the following scenario: Data lib in C# compiled as a Windows Runtime

  • 0

I have the following scenario:
Data lib in C# compiled as a Windows Runtime component.

One of its classes is looks like this:

public sealed class MyData
{
  string TheGoods { get; private set;}
}

The UI is in WinJS, and I have the following:

var b = dataInstance.theGoods;

The problem is that I get an exception and property has the following in it:

System.ArgumentNullException
at System.StubHelpers.HStringMarshaler.ConvertToNative(String managed)

Looking at the implementation of HStringMarshaler.ConvertToNative, it seems to throw if the string is null.

Does that mean that it’s impossible to expose a null string to WinJS? Is that a WinJS limitation or does that apply to all WinRT?

While string.Empty does work, that’s not semantically the same as null and in some cases, empty is valid and different than null.

If I change the type of the property to be ‘object’, then it does work, but it seems nasty to expose an object when it really ought to be a string.
Any ideas? The docs are pretty light on this

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:11:12+00:00Added an answer on June 13, 2026 at 10:11 am

    The Windows Runtime string type is a value type and has no null value. The .NET projection prohibits passing a null .NET string across the Windows Runtime ABI boundary for this reason.

    The string type used by the Windows Runtime is the HSTRING type. While this type does not have a null value, it does have a null representation (that is, in C++, HSTRING s = nullptr; is valid). An HSTRING with a null representation is an empty string.

    The .NET projection converts this null representation into an empty string (String.Empty) for strings coming in from the ABI boundary, and prohibits actual null .NET strings from being passed back across the ABI boundary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In general, I have the following scenario: Fetch product and its related data from
I have the following scenario: I have various user's data stored in my database.
I have the following scenario: Entities are loaded from the database. One of them
Let's assume we have the following generic scenario: An RDBMS as a data source,
I needed suggestions for the following scenario. I have a php variable called $data
You have the following scenario: //Two threads, using shared data shared data = 2
I have the following scenario: Data from multiple video files needs to be held
I have the following scenario in zend framework: Data Table of students Table of
I have the following scenario : ETL loads data into the DW. Reports run
I have the following scenario that may warrant storing data in a conroller member

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.