Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Cory Smith
    @DualBrain
    @paul1956 I'm simultaneously happy and tramatized watching the work take place on the whole SingleInstance process through github. It's awesome to see that there is a ton of review and a lot of eyes - if this much effort goes into everything... no wonder the wheels turning so slowly. ;-) I suppose in the end it's a good thing... helps to protect all of us in the end.
    "I believe Using statement should be avoid." <--- Huh?
    Paul M Cohen
    @paul1956
    Yes, after a few comments I decided to ignore the rest. It’s Jared’s that I find most disturbing, “Ignore editor.Config”and follow the style of decades old code” that to me was the Huh? The one file had 1/2 of the style violations of the entire Repo.
    Adam Speight
    @AdamSpeight2008
    Jared is too focused on the "style of the code" rather than the function of the code.
    Paul M Cohen
    @paul1956
    Agreed.
    Mohammad Hamdy Ghanem
    @VBAndCs
    I hope you participate in this discussion about Vlazor (VB.NET Blazor) dotnet/vblang#534
    Cory Smith
    @DualBrain

    I have to point out something that is not only annoying me, but also affecting @paul1956 . It is pretty silly that the VB style of checking for whether or not a string has a value or not is warned against.

    If MyString <> "" Then

    The suggested "fix" is that you have to write:

    If String.IsNullOrEmpty(MyString) Then

    Seriously????

    Why do I, as the writer (and ultimately reader) have to conform to such a mechanism? The first way is a) eaiser to type and b) from at least my point of view, easier to read.

    Sure... we could also write:

    If MyString?.Length > 0 Then

    But why?

    Having Visual Studio constantly bark at me because I'm doing it the VB way... in VB... is really damned annoying.

    Furthermore, having the dotnet team complain about the VB... way... really?!?!

    Annoying...

    Jeff Bowman
    @InteXX
    @DualBrain I agree. In my case, at least, I've been able to mitigate the issue somewhat by using a pair of extension methods in a private package that I add to all my projects by default.
      <Extension>
      <DebuggerStepThrough>
      Public Function IsNothingOrEmpty(Instance As String) As Boolean
        Return String.IsNullOrEmpty(Instance)
      End Function
    
      <Extension>
      <DebuggerStepThrough>
      Public Function IsNothingOrWhiteSpace(Instance As String) As Boolean
        Return String.IsNullOrWhiteSpace(Instance)
      End Function
    Paul M Cohen
    @paul1956
    These don’t stop VS from complaining. All my code used to include them but they are not understood by Analyzers. The analyzer is wrong for VB where Nothing = “” is True. I am still confused about CType(Nothing, String). IsNothingOrWhitespace because I always thought it worked but there say be some extensions that fail to check for Nothing.
    Paul M Cohen
    @paul1956
    I think there needs to be an Attribute (maybe that is what Nullability is about) that I can put on my Extension to tell the analyzer that a VB Extension is Null/Nothing safe.
    Jeff Bowman
    @InteXX
    @paul1956 I'm interested in this. Could you provide some repro steps?
    Paul M Cohen
    @paul1956
    @InteXX not sure what you are asking?
    Jeff Bowman
    @InteXX
    @paul1956 VS doesn't complain about these extension methods, at least to me. I'd like to be able to reproduce what you're talking about.
    Paul M Cohen
    @paul1956
    Are you using editorConfig and/or Dotnet/Roslyn?
    # editorconfig.org
    
    # top-most EditorConfig file
    root = true
    
    # Default settings:
    # A newline ending every file
    # Use 4 spaces as indentation
    [*]
    indent_style = space
    indent_size = 4
    
    [*.json]
    indent_size = 2
    
    # C# and VB files
    [*.{cs,vb}]
    charset = utf-8-bom
    insert_final_newline = true
    trim_trailing_whitespace = true
    
    # avoid this. unless absolutely necessary
    dotnet_style_qualification_for_field = false:suggestion
    dotnet_style_qualification_for_property = false:suggestion
    dotnet_style_qualification_for_method = false:suggestion
    dotnet_style_qualification_for_event = false:suggestion
    # use language keywords instead of BCL types
    dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
    dotnet_style_predefined_type_for_member_access = true:suggestion
    
    # name all constant fields using PascalCase
    dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
    dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols  = constant_fields
    dotnet_naming_rule.constant_fields_should_be_pascal_case.style    = pascal_case_style
    
    dotnet_naming_symbols.constant_fields.applicable_kinds   = field
    dotnet_naming_symbols.constant_fields.required_modifiers = const
    
    dotnet_naming_style.pascal_case_style.capitalization = pascal_case
    
    # static fields should have s_ prefix
    dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
    dotnet_naming_rule.static_fields_should_have_prefix.symbols  = static_fields
    dotnet_naming_rule.static_fields_should_have_prefix.style    = static_prefix_style
    
    dotnet_naming_symbols.static_fields.applicable_kinds   = field
    dotnet_naming_symbols.static_fields.required_modifiers = static
    
    dotnet_naming_style.static_prefix_style.required_prefix = s_
    dotnet_naming_style.static_prefix_style.capitalization = camel_case
    
    # internal and private fields should be _camelCase
    dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
    dotnet_naming_rule.camel_case_for_private_internal_fields.symbols  = private_internal_fields
    dotnet_naming_rule.camel_case_for_private_internal_fields.style    = camel_case_underscore_style
    
    dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
    dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
    
    dotnet_naming_style.camel_case_underscore_style.required_prefix = _
    dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
    
    # Code style defaults
    dotnet_sort_system_directives_first = true
    
    # Expression-level preferences
    dotnet_style_object_initializer = true:suggestion
    dotnet_style_collection_initializer = true:suggestion
    dotnet_style_explicit_tuple_names = true:suggestion
    dotnet_style_coalesce_expression = true:suggestion
    dotnet_style_null_propagation = true:suggestion
    
    # C# files
    [*.cs]
    # New line preferences
    csharp_new_line_before_open_brace = all
    csharp_new_line_before_else = true
    csharp_new_line_before_catch = true
    csharp_new_line_before_finally = true
    csharp_new_line_before_members_in_object_initializers = true
    csharp_new_line_before_members_in_anonymous_types = true
    csharp_new_line_between_query_expression_clauses = true
    
    # Indentation preferences
    csharp_indent_block_contents = true
    csharp_indent_braces = false
    csharp_indent_case_contents = true
    csharp_indent_switch_labels = true
    csharp_indent_labels = one_less_than_current
    
    # only use var when it's obvious what the variable type is
    csharp_style_var_for_built_in_types = false:none
    csharp_style_var_when_type_is_apparent = false:none
    csharp_style_var_elsewhere = false:suggestion
    
    
    # Code style defaults
    csharp_preserve_single_line_blocks = true
    csharp_preserve_single_line_statements = false
    
    # Expression-bodied members
    csharp_style_expression_bodied_methods = false:none
    csharp_style_expression_bodied_constructors = false:none
    csharp_style_expression_bodied_operators = false:none
    csharp_style_expression_bodied_properties = true:none
    csharp_style_expression_bodied_indexers = true:none
    csharp_style_expression_bodied_accessors = true:none
    
    # Pattern matching
    csharp_style_pattern_matching_over_is_
    Above is from WinForms should be identical to DotNet defaults and Roslyn.
    I am also using Version 16.6.0 Preview 3.0
    Jeff Bowman
    @InteXX
    @paul1956 I am not. I probably should be.
    Paul M Cohen
    @paul1956
    image.png
    The problem is when the string is passed in as a Parameter to a public function even though I call extension IsNullOrWhitespace the analyzer don't know about it.
    Paul M Cohen
    @paul1956
    Hence the little green squiggle above.
    Jeff Bowman
    @InteXX
    @paul1956 OK, I see now. Yes, that's pretty ugly.
    Paul M Cohen
    @paul1956
    That is why I stopped using by own extensions which is unfortunate because I would like the "Not" versions as well.
    Jeff Bowman
    @InteXX

    @paul1956 What happens if you wrap x in a Trim() call?

    If Trim(x).IsNullOrWhiteSpace Then
      Return ""
    End If

    I realize that breaks your conditional test, but I'm just curious.

    Paul M Cohen
    @paul1956
    image.png
    @InteXX My example wasn't real code, I created it to show the issue. Doesn't help, you don't get it at the trim but you do get it later then you use x.
    Jeff Bowman
    @InteXX
    @paul1956 OK
    Paul M Cohen
    @paul1956
    use Value in above example.
    Jeff Bowman
    @InteXX
    @paul1956 OK
    Cory Smith
    @DualBrain
    @paul1956 So... ummmm... what's the deal with https://github.com/dotnet/winforms/pull/3050#issuecomment-620351276? Is your contribution being rejected? Following the thread is a whirlwind of (what appears to be) nit pick complaints containing somewhat confusing/contrary requirements ("When there is a conflict between editor config and the current file prefer the style of the current file." - that wouldn't ever lead to any sort of "guessing", oh no, never.). Or are they deciding to go forward with design by committee to make this a C# feature thus making it a risk that it won't be available for us in a reasonable timeframe - or worse - will not be a "VB" solution when it's all said and done.
    Paul M Cohen
    @paul1956
    @DualBrain as I understand it, the format needs to follow existing design and not editorConfig for old code (from Reference Source) or all the formatting needs updating. I submitted a PR to update all WinForms VB code to follow editor.Config and it has been merged. I was asked to close my Single Instance PR because Microsoft has decide to include the feature as a System.Windows.Forms private feature and exposed through VisualBasic.WindowsFormsApplicationBase in Core 5.0 and consider making it available to all languages in Core 6.0. There is a new PR dotnet/winforms#3131 to track this effort. While my PR worked for VB, full testing was very difficult because of the design, if you need it sooner it is included in my CodeConverter under a separate folder and exposes the code that calculates what is an identical instance as an overridable function.
    Cory Smith
    @DualBrain
    You know... for all of the negative stuff around VB... it sure is odd how much stuff from VB has made it's way into the other language(s). ;-)
    Paul M Cohen
    @paul1956
    @DualBrain So true
    Mohammad Hamdy Ghanem
    @VBAndCs
    I am still trying to run VB.NET code in wasm. I don't like Blazor at all, and I am trying to create another path to wasm. I proposed this in Monon wasm and hope we can make it happen (thou we may contribute in C# code to create the library).
    In fact I am trying to contact people who already made similar efforts in creating such library like script# and Ooui praeclarum/Ooui#245
    I don't want to fight this alone.
    Mohammad Hamdy Ghanem
    @VBAndCs
    I could have try to create all the tools myself, except this needs a deep knowledge about wasm and mono wasm which I dob't have, so, I contacted wasm, and they told me about interface-types. The Blazor team is not willing to do any thing differenet, so, I contacted Mono wasm to see how can they make use of that, and there is a good response. This can move forward if there is a community contributions.
    Note that I say nothing about VB.NET. There is alot of hate towards VB.NET, and issues closed as soon as I say the VB word! So, lets keep our true agenda hidden for a while :)
    In fact the path I am proposing is superior to Balzor and will allow us to use wpf/UWP/Xamarin in the web like Qoui and cshtml5 do, besides using Blazor component as well, but with minimum download size.
    Paul M Cohen
    @paul1956
    Updated C# to VB converter, added full solution conversion with many other features.
    Jeff Bowman
    @InteXX
    @VBAndCs "So, lets keep our true agenda hidden for a while" The spy who loved us ;-)
    Mohammad Hamdy Ghanem
    @VBAndCs
    :D
    What else to do? They treat VB.NET as a crime :(
    @paul1956 I depend on your converter daily. It is helpful. I hope you try to create IL to VB converter, so you don't have to update the converter with every new C# release.
    ILspy is open source
    Mohammad Hamdy Ghanem
    @VBAndCs
    it is a obfuscator , so it converts il to C#
    previously it had an option to convert it to VB but disappeared in recent versions
    you can make use of it's source to convert IL to VB.NET code