Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
RussellSmith2 opened this issue Jan 13, 2020 · 3 comments
Closed
Assignees
Labels
C# -> VB Specific to C# -> VB conversion compilation error A bug where the converted output won't compile

Comments

@RussellSmith2
Copy link
Contributor

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
@RussellSmith2 RussellSmith2 added the C# -> VB Specific to C# -> VB conversion label Jan 13, 2020
@RussellSmith2
Copy link
Contributor Author

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);
    }
}

@GrahamTheCoder GrahamTheCoder self-assigned this Jan 25, 2020
@GrahamTheCoder GrahamTheCoder added the compilation error A bug where the converted output won't compile label Mar 8, 2020
@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Mar 8, 2020

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

@GrahamTheCoder GrahamTheCoder changed the title C# -> VB: If pre-processing directives are not converted. C# -> VB: If pre-processing directive contents are not converted. Mar 9, 2020
@GrahamTheCoder
Copy link
Member

Consolidating into #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# -> VB Specific to C# -> VB conversion compilation error A bug where the converted output won't compile
Projects
None yet
Development

No branches or pull requests

2 participants