Can't seem to use #if in Cross-Platform Library #3932
Labels
kind/bug
Something isn't working
triage/untriaged
Indicates an issue requires triaging or verification
Current behavior
Error CS0234: The type or namespace name 'Data' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
When using #if to share code with a WPF project in a Cross-Platform Library. System.Windows is WPF code that the compiler should be ignoring
Expected behavior
Compile with no issues.
How to reproduce it (as minimally and precisely as possible)
Create a new uno project. Within the project create a new 'Cross-Platform Library'. In the class library class, insert the following code:
`using System;
#if UNO_1213
using Windows.UI.Xaml.Data;
#else
using System.Windows.Data;
using System.Windows;
#endif
namespace ClassLibrary
{
public class Class1:IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
In the Properties for the class library project define a conditional symbol of UNO_1213. Visual Studio doesn't seem to know that UNO_1213 is defined because IValueConverter remains red - yet Windows.UI.Xaml.Data is not grayed out. So it obviously understands it's turned on to some extent. If I change the #if to something else it does become grayed out:
Sample project including msbuild.binlog enclosed
Workaround
None so far
Environment
Nuget Package:
Nuget Package Version(s):
Affected platform(s):
IDE:
Relevant plugins:
UnoTester.zip
The text was updated successfully, but these errors were encountered: