I have a Windows Store application that uses a background task. The background task is stored in a Windows Runtime Component project. (This structure appears to be the only way to make background tasks work.)
In the background task project, I have some externally visible public methods that have return/parameter types that are my own classes rather than Windows Runtime classes.
For example:
public MyClass DoSomething()
{
return null;
}
When I build, I receive errors such as the following in relation to these methods:
Method 'X' returns 'Y', which is not a valid Windows Runtime type. Methods exposed to Windows Runtime must return only Windows Runtime types.
and
Method 'T' has parameter 'U' of type 'W'. 'W' is not a valid Windows Runtime parameter type.
I can understand what the errors are saying, but I haven't thought of a good way I can structure my code so that I meet these requirements.
Here are some things I have already considered:
Tuple
s or multiple parameters, but this seems messy, less structured and less maintainable. I am strongly against this type of programming.I was able to make this work by isolating the background task in a Windows Component project and moving the re-usable Windows Runtime-dependent code into a Windows Store Class Library project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With