Skip to content

C# -> VB: If pre-processing directive contents are not converted. #489

Closed

Description

@RussellSmith2

Input code

namespace ICSharpCode.CodeConverter.Util
{
#if NR6
    public
#endif
    static partial class EnumerableExtensions
    {
		
	}
}

Erroneous output

Namespace ICSharpCode.CodeConverter.Util
    Friend Partial Module EnumerableExtensions
    End Module
End Namespace

Expected output

Namespace ICSharpCode.CodeConverter.Util
#If NR6 Then
    public
#End If
    Partial Module EnumerableExtensions
    End Module
End Namespace

Details

If pre-processing directives are not converted.

  • Version in use: Current compiled repository

Activity

  1. added
    C# -> VB
    on Jan 13, 2020
  2. RussellSmith2 commented on Jan 13, 2020

    @RussellSmith2
    ContributorAuthor

    For reference, here is a more complicated example to convert.

    Input code

    using System;
    
    namespace ICSharpCode.CodeConverter.Shared
    {
        internal static class Env
        {
            /// <summary>
            /// Should be used to control any degree of parallelism in the codebase
            /// </summary>
            public static byte MaxDop =
    #if DEBUG
                System.Diagnostics.Debugger.IsAttached ? (byte) 1 :
    #endif
                (byte)Math.Min(Math.Max(Environment.ProcessorCount, byte.MinValue + 1), byte.MaxValue);
        }
    }
  3. added
    compilation error
    on Mar 8, 2020
  4. GrahamTheCoder commented on Mar 8, 2020

    @GrahamTheCoder
    Member

    The first case works as of #517. However the code within the conditional isn't processed, it just happens to be valid in this case, so I'll leave this open for now

  5. changed the title [-]C# -> VB: If pre-processing directives are not converted.[/-] [+]C# -> VB: If pre-processing directive contents are not converted.[/+] on Mar 9, 2020
  6. GrahamTheCoder commented on Mar 20, 2020

    @GrahamTheCoder
    Member

    Consolidating into #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

C# -> VBcompilation error

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions