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

[VS2019] Build Failure: syntax error at token 'inf' #128

Closed
theoractice opened this issue Dec 13, 2019 · 9 comments
Closed

[VS2019] Build Failure: syntax error at token 'inf' #128

theoractice opened this issue Dec 13, 2019 · 9 comments

Comments

@theoractice
Copy link

This is with the latest VS2019 version 16.4.
Build log:

1>E:\Users\Administrator\git\GMMatchvs\packages\DllExport.1.6.5\tools\net.r_eg.DllExport.targets(59,5): error : C:\Users\Administrator\AppData\Local\Temp\tmp3792\GMMatchvs.x86.il(182) : error : syntax error at token 'inf' in:   .field public static literal float32 'Infinity' = float32(inf)
1>E:\Users\Administrator\git\GMMatchvs\packages\DllExport.1.6.5\tools\net.r_eg.DllExport.targets(59,5): error : 
1>     在 RGiesecke.DllExport.Parsing.IlParser.RunIlTool(String installPath, String toolFileName, String requiredPaths, String workingDirectory, String settingsName, String arguments, String toolLoggingCode, String verboseLoggingCode, IDllExportNotifier notifier, Int32 timeout, Func`2 suppressErrorOutputLine) 位置 C:\projects\dllexport\RGiesecke.DllExport\Parsing\IlParser.cs:行号 368
1>     在 RGiesecke.DllExport.Parsing.IlAsm.RunCore(CpuPlatform cpu, String fileName, String ressourceParam, String ilSuffix) 位置 C:\projects\dllexport\RGiesecke.DllExport\Parsing\ILAsm.cs:行号 143
1>     在 RGiesecke.DllExport.Parsing.IlAsm.Run(String outputFile, String ilSuffix, CpuPlatform cpu) 位置 C:\projects\dllexport\RGiesecke.DllExport\Parsing\ILAsm.cs:行号 113
1>     在 RGiesecke.DllExport.Parsing.IlAsm.ReassembleFile(String outputFile, String ilSuffix, CpuPlatform cpu) 位置 C:\projects\dllexport\RGiesecke.DllExport\Parsing\ILAsm.cs:行号 52
1>     在 RGiesecke.DllExport.DllExportWeaver.reassembleFile(IlAsm ilAsm, String outputFile, String ilSuffix, CpuPlatform cpu) 位置 C:\projects\dllexport\RGiesecke.DllExport\DllExportWeaver.cs:行号 198
1>     在 RGiesecke.DllExport.DllExportWeaver.RunIlAsm(IlAsm ilAsm) 位置 C:\projects\dllexport\RGiesecke.DllExport\DllExportWeaver.cs:行号 163
1>     在 RGiesecke.DllExport.DllExportWeaver.Run() 位置 C:\projects\dllexport\RGiesecke.DllExport\DllExportWeaver.cs:行号 89
1>     在 RGiesecke.DllExport.MSBuild.ExportTaskImplementation`1.Execute() 位置 C:\projects\dllexport\RGiesecke.DllExport.MSBuild\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:行号 463

Maybe this is what happened: syntax error at token 'inf' in: .field public static literal float32 'Infinity' = float32(inf).

The problematic il snippet:

...
// =============== CLASS MEMBERS DECLARATION ===================

.class public sequential ansi sealed beforefieldinit 'Mathf'
       extends ['mscorlib']'System'.'ValueType'
{
  .pack 0
  .size 1
  .field public static literal float32 'PI' = float32(3.141593)
  .field public static literal float32 'Infinity' = float32(inf)
  .field public static literal float32 'NegativeInfinity' = float32(-inf)
  .field public static literal float32 'Deg2Rad' = float32(1.7453291e-02)
  .field public static literal float32 'Rad2Deg' = float32(57.29578)
  .method public hidebysig static float32 
          'Sin'(float32 'f') cil managed
  {
    // 代码大小       9 (0x9)
    .maxstack  8
    IL_0000:  ldarg.0
    IL_0001:  conv.r8
    IL_0002:  call       float64 ['mscorlib']'System'.'Math'::'Sin'(float64)
    IL_0007:  conv.r4
    IL_0008:  ret
  } // end of method 'Mathf'::'Sin'
...

Any ideas?

@theoractice theoractice changed the title [VS2019] Build Failure [VS2019] Build Failure: syntax error at token 'inf' Dec 13, 2019
@theoractice
Copy link
Author

@3F
Copy link
Owner

3F commented Dec 13, 2019

Please clarify the following:

What DllExport version? What ILAsm/ILDasm? What project type?

Did you try our custom ilasm/ildasm versions?

And can you try with my latest 4.700.2 version: https://github.com/3F/coreclr

@theoractice
Copy link
Author

theoractice commented Dec 13, 2019

Ah, never know there is a version for .net core, that's very helpful, thanks.
However I'm using v1.6.5 with a .net framework dll project so this issue is not .net core related. I tried every option that I could find including the "Use our IL Assembler" one, and none of them worked.

3F added a commit that referenced this issue Dec 13, 2019
* FIXED: Fixed possible "Invalid memory access" (JNA/Java). Issue #125.
         For C/C++ such as "Unhandled exception at ... (KernelBase)"

         https://twitter.com/GitHub3F/status/1201904821093187585

* FIXED: Fixed 'Failed to resolve assembly...' when .NET Standard. Issue #127.

* FIXED: Fixed error when switching between .sln in UI. Wizard.

* FIXED: Fixed possible duplication of `PlatformTarget` during setup.

* NEW: Implemented "Rebase System Object" option for our assembler.

* CHANGED: New installation behavior through official NuGet.

* CHANGED: New wizard layout for 1.7.

* CHANGED: Updated CoreCLR 3.1.0 RTM \ IL Assembler 4.700.2.
           https://github.com/3F/coreclr/releases/tag/ILAsm.4.700.2

           Includes an implemented `/REBASE` feature for related issue #125.

* CHANGED: Updated Mono Cecil 0.11.1
           https://github.com/jbevain/cecil/releases/tag/0.11.1

* CHANGED: Updated Conari 1.4
           https://github.com/3F/Conari/releases/tag/1.4

* KNOWN: Possible syntax error at token 'inf'. Issue #128.
         #128

* KNOWN: You can finally get another System.Object in modified assembly:
         #90 (comment)

* NOTE: Please don't use beta releases in production!

* NOTE: Please report about something here: https://github.com/3F/DllExport/issues
@3F
Copy link
Owner

3F commented Dec 13, 2019

I confirm the mismatch between versions.

ILDasm 4.8.3928.0 marks this as inf/-inf While the most modern ILAsm (4.8.3761.0 on my laptop) can only process it as 0x7F800000/0xFF800000 values (for single precision of course).

So, Actually you need address it to Microsoft. Because we already provide our own modified versions. Please use this instead.

I tried every option that I could find including the "Use our IL Assembler" one, and none of them worked.

Please attach log with diagnostic key:

msbuild /v:diag

Or please minimal reproducible project sample. Because I don't see problems when our assembler.

Ah, never know there is a version for .net core, that's very helpful, thanks.

Yes, planned 1.7 provides both support for netfx and netcore.

Beta2 release is just out: https://twitter.com/GitHub3F/status/1205616579607715840

@3F 3F added the 3rd-party label Dec 13, 2019
3F added a commit that referenced this issue Dec 15, 2019
Related Issue #128

Also updated layout: GdiCharSet = 0 + background caption to filter projects by path
3F added a commit that referenced this issue Dec 15, 2019
* FIXED: Mismatch of the name of the exported function with the specified value.
         Issue #129.

* FIXED: Unchangeable cdecl convention. Part of Issue #129.

* FIXED: Fixed possible duplication of `DllExportSysObjRebase` during setup.

* NEW: Implemented "Single + Double Inf/-Inf token patching" option.
       Related Issue #128.

* KNOWN: You can finally get another System.Object in modified assembly:
         #90 (comment)

* NOTE: Please don't use beta releases in production!

* NOTE: Please report about something here: https://github.com/3F/DllExport/issues
@3F 3F added support and removed bug labels Dec 15, 2019
@3F
Copy link
Owner

3F commented Dec 15, 2019

1.7 Beta3 release provides now Single + Double Inf/-Inf token patching option.

Check this out.

@3F 3F closed this as completed Dec 15, 2019
@3F 3F added this to the 1.7 milestone Dec 15, 2019
@theoractice
Copy link
Author

1.7 beta3 with the "Use our IL Assembler" option works, thanks.

Or please minimal reproducible project sample. Because I don't see problems when our assembler.

Version 1.6.5 with the "Use our IL Assembler" option yields this error:
error : Failed to define security permission set for 0x20000001
Sorry I forgot to mention this type of error in previous comments, but that's how it fails. Just post here FYI.

1.7 Beta3 release provides now Single + Double Inf/-Inf token patching option.

I cannot find that option in the config window. In fact it looks like this:
image
And if I uncheck the "Use our IL Assembler" option, then the inf error reappears.
Are there any options hidden because of the window size? I cannot resize it.

@3F
Copy link
Owner

3F commented Dec 17, 2019

1.7 beta3 with the "Use our IL Assembler" option works, thanks.

Good! FYI, This patch can be also applied for original MS assembler on netfx.

error : Failed to define security permission set for 0x20000001

This is known error: #19 (comment)

I cannot find that option in the config window.

Yes, more like the problem with layout, again on Chinese system: #61

You can temporarily configure it manually, please update value for DllExportPatches in your settings (project files or external target depends on your choice):

You need set the first bit for mask:

/// <summary>
/// Affects ldc.r8; ldc.r4; .field;
/// 
/// inf/-inf to 0x7F800000/0xFF800000 
///             0x7FF0000000000000/0xFFF0000000000000
/// 
/// https://github.com/3F/DllExport/issues/128
/// </summary>
InfToken = 0x01,

eg.:

<DllExportPatches>here</DllExportPatches>

I cannot resize it.

It shouldn't be resized. Please continue here: #61 (comment)

@theoractice
Copy link
Author

All problems solved, thank you very much.

3F added a commit that referenced this issue Jan 21, 2020
* NEW: Allowed .NET Standard 1.1 and above targeting.

* FIXED: Fixed "Sdk.WindowsDesktop" problem for .NET Core / SDK-based projects.
         Details in PR #123.

* FIXED: Fixed beta3 incorrect layout (Thanks @Genteure, PR #131).

         Related problem with `Inf/-Inf token patching` option:
         #128 (comment)

* FIXED: DllExport crashing with proxy authentication error. Issue #133.

* FIXED: Fixed actions for `-mgr-up` key.
         Including `-action Upgrade` ( Update + mgr-up + force keys )

* FIXED: Fixes possible MSB1006 for proxycfg property.
         "MSB1006: Property is not valid. Switch: proxycfg"

* CHANGED: UI. VS project icons under Visual Studio 2017 Image Library EULA.RTF license.

* CHANGED: init.ps1 adds optional copying of package data for our manager.
           Part of the "new installation behavior through official NuGet." (beta2)

           Please note: This is not nuget support!
                        It just replaces known info-form that was in 1.6.x.

* CHANGED: Local scope when invoking .\DllExport manager in project files.

* CHANGED: Updated GetNuTool 1.8
           https://github.com/3F/GetNuTool/releases/tag/1.8

* NOTE: Please don't use beta releases in production!

* NOTE: Please report about something here: https://github.com/3F/DllExport/issues
3F added a commit that referenced this issue Jan 31, 2020
* NEW: .NET Core based projects support.
       Issues: #90, #67
       PR: #123

* NEW: .NET Standard 1.1 and above targeting support.

* NEW: Implemented "Single + Double Inf/-Inf token patching" option.
       Related Issue #128.

* NEW: Implemented "Rebase System Object" option for our assembler.

        Helps to avoid possible "Invalid memory access" (JNA/Java). Issue #125.
        For C/C++ such as "Unhandled exception at ... (KernelBase)"

        https://twitter.com/GitHub3F/status/1201904821093187585
        Part of PR #123

* NEW: Implemented updater for wizard. Issue #109.

* NEW: Textual export of affected data to diag.

* CHANGED: Updated CoreCLR 3.1.0 LTS \ IL Assembler 4.700.2.
           https://github.com/3F/coreclr/releases/tag/ILAsm.4.700.2

           Includes an implemented `/REBASE` feature for related issue #125.

* CHANGED: New installation behavior through official NuGet.
           init.ps1 also adds optional copying of package data for our manager.

           Please note: This is not nuget support!
                        It just replaces known info-form that was in 1.6.x.

* CHANGED: New wizard layout for 1.7.

* CHANGED: Local scope when invoking .\DllExport manager in project files.

* CHANGED: Updated logic for an offline versions
            with optional converting to online if needed.

* CHANGED: Updated MvsSln 2.5.1
           https://github.com/3F/MvsSln/releases/tag/2.5.1

* CHANGED: Updated hMSBuild 2.3
           https://github.com/3F/hMSBuild/releases/tag/v2.3

* KNOWN: You can finally get another System.Object in modified assembly:
         #90 (comment)

* NOTE: You need an updated/modern manager to avoid problem
        when "Possible incorrect Sdk-based project types": PR #123
        3F/MvsSln#23

        Use it from official 1.7 release:
        https://github.com/3F/DllExport/releases/tag/v1.7
        https://www.nuget.org/packages/DllExport/1.7.0

        Otherwise you need provide manually msbuild instance
        that can process modern Sdk-types due to modern VS/dotnet sdk
        dependencies for netcore-based projects.

        For example, through hMSBuild https://github.com/3F/hMSBuild
        ```
        DllExport ... -msb hMSBuild
        ```

* NOTE: For command-line mode, To upgrade configured version to 1.7:
        ```
            DllExport -action Upgrade -dxp-version 1.7.0
        ```
@3F 3F mentioned this issue Jan 8, 2021
@qysnn
Copy link

qysnn commented Sep 23, 2022

I run into the exact same issue on VS 2022 and can confirm that the Single + Double Inf/-Inf token patching option solves it.

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

No branches or pull requests

3 participants