Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
CyrusNajmabadi
@CyrusNajmabadi
then, if you update your generator, and you only make a cosmetic difference, your test doesn't fail.
My point is... if you do this, you don't need to watch anything in teh first place :)
your tests either pass, and everything is good. or they fail, and you know why.
This is much faster
in one case you hae to do work. in the other, the test harness does the work (likely in <1ms or 1mu-s per test) :)
Stephen A. Imhoff
@Clockwork-Muse

I can watch the output while debugging.

This is antithetical to good testing output. Your test report should clearly say "this specific thing is unexpected". For one thing, this enables compile/test runs on targets you can't interactively debug (for example, you can legally only develop code for a Mac on a Mac - I don't want to buy one if I can help it, so github actions for me)

Mohammad Hamdy Ghanem
@VBAndCs
I use tests as a helper tool not a goal. It did helped like this in this project. If I ran into troubles I will modify them as needed. Thanks.
CyrusNajmabadi
@CyrusNajmabadi
I use tests as a helper tool not a goal
Sure. the general point here is that there are more effective ways to use them (in terms of spending less time to get more value out of htem).
You're welcome to test however you want. You're just likely going to get feedback from a lot of people that you're spinning your wheels a lot :)
Mohammad Hamdy Ghanem
@VBAndCs
Think of the checksum as a bonus. I need to run the whole generator and make sure it doesn't throw. The test can end here, but I added a checksum to make sure that the output file is ok. There are other tests focusing on the important parts of the generated code (the property definition, the constructor, and the With method). It is a good idea to ignore white-spaces in comparison, but this will need time and will give me nothing write now. May be I can do it in new tests to come. Thanks.
CyrusNajmabadi
@CyrusNajmabadi
up to you :)
Paul M Cohen
@paul1956
@VBAndCs I never depend on line ending, I use several functions that deal with the various line ending in a language/encoding independent way. Look here https://github.com/paul1956/CSharpToVB/blob/master/CodeConverter/Utilities/UnicodeNewline.vb
Mohammad Hamdy Ghanem
@VBAndCs
Nice, but I am not parsing here. I am just normalizing. I can include white spaces in normalization like this:
Public Function Normalize(str As String) As String
    Dim sb As New StringBuilder(str)

    ' Normalize tab and line terminator
    sb.Replace(vbTab, " ")
    sb.Replace(vbCr, vbLf)

    ' Remove duplicate spaces
    DeleteDuplicates(" ", sb)

    ' Trim each line
    sb.Replace(vbLf & " ", vbLf)
    sb.Replace(" " & vbLf, vbLf)

    ' Remove duplicate lines
    DeleteDuplicates(vbLf, sb)

    ' Trim the string
    If sb(0) = " " OrElse sb(0) = vbLf Then sb.Remove(0, 1)
    Dim en = sb.Length - 1
    If sb(en) = " " OrElse sb(en) = vbLf Then sb.Remove(en, 1)

    Return sb.ToString()
End Function
Sub DeleteDuplicates(str As String, fromStr As StringBuilder)
    Dim L As Integer
    Dim dupStr = str & str
    Do
        L = fromStr.Length
        fromStr.Replace(dupStr, str)
        If L = fromStr.Length Then Return
    Loop
End Sub
Mohammad Hamdy Ghanem
@VBAndCs
Is vb pretty listing available to us via Roslyn API? I want to apply it on the generated code
Paul M Cohen
@paul1956
Yes. There is NormalizeWhiteSpace and AsyncFormatAsync to start depending on what you are looking for.
Eugene
@JohnyL
@steveharter As for your answer. Yes, I have mentioned using JsonSerializeralready in my dotnet/runtime#54158. But what is CreateFromObject you have mentioned? Is it about to appear in API?
Paul M Cohen
@paul1956
Will the SourceGenerator for JSON be available for VB as well?
masonwheeler
@masonwheeler
Isn't VB.NET basically "in maintenance mode" now?
Paul M Cohen
@paul1956
@masonwheeler No, in fact is just got Source Generators and support for System.JSON.
CyrusNajmabadi
@CyrusNajmabadi
Yeah. Vb is not in maintenance mode.
It's currently in active development.
masonwheeler
@masonwheeler
OK, maybe not. Don't remember where, but I definitely heard someone say that a few months ago. I guess they were wrong.
Paul M Cohen
@paul1956
None of that answered the original question about VB source generator for JSON.
akima15
@akima15

We have detected that your app is incompatible with Windows 10 S. Please update your app to support Windows 10 S if possible. Otherwise include a prominent statement anywhere in the Metadata that the app does not support Windows 10 S. This issue may affect merchandisability.

This seems to be the reason after enabling "SiPolicy_Audit.p7b":

Code integrity determined that a process x attempted to load
dotnet\shared\Microsoft.NETCore.App\5.0.9\System.IO.FileSystem.dll
dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Diagnostics.FileVersionInfo.dll
dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Text.RegularExpressions.dll
dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Text.Json.dll
that did meet the Custom 1 signing level requirements or violated code integrity policy (Policy ID:{A244370E-44C9-4C06-B551-F6016E563076}). However, due to code integrity auditing policy, the image was allowed to load.

So this means every app made with NET5 can't run in Windows 10 S Mode? Is this normal? o.o

Michael W Powell
@mwpowellhtx
Q: does anyone have any ideas what the migration path for netstandard target assemblies is in light of the coming .NET 6? I've asked in a couple of forums and gotten ambiguous responses leading me to believe that, "there is no migration path", but what does this mean in light of 6? what is the proposed solution to that issue? thanks...
Joe4evr
@Joe4evr
@mwpowellhtx the migration path is simply having your libraries target .NET 5/6 (where possible)
Michael W Powell
@mwpowellhtx
@Joe4evr thanks, after drudging up a couple of odd blogs about it, figured that might be the case. what I am more miffed at is the politicking dance. if this is known, then that is a fairly direct answer I think. i.e. multitarget your assemblies, possibly, i.e. netstandard2.x and /or net5.0 and/or net6.0, along these lines. Not counting target choices, which API surface areas are appropriate, etc.
CyrusNajmabadi
@CyrusNajmabadi
@mwpowellhtx this is what i mentioned to you when you asked :)
Ciaran ODonnell
@ciaranodonnell
Is this the right room for a Gitter noob to ask questions about source generators? And why my generator that generates a property ends up with an entry in the Error Window saying "The type 'TestEntity' already contains a definition for 'TestProperty'" but I can't access the generated property in code.
Michael W Powell
@mwpowellhtx
@CyrusNajmabadi sorry, must've gotten swamped amid other unrelated bits. never saw it, but I appreciate the response.
CyrusNajmabadi
@CyrusNajmabadi
no worries