3F / DllExport

.NET DllExport with .NET Core support (aka 3F/DllExport aka DllExport.bat)
MIT License
961 stars 133 forks source link

double.NaN leads to errors #174

Closed kcl93 closed 3 years ago

kcl93 commented 3 years ago

Steps to reproduce:

Hello together :) When adding double.NaN or 0.0/0.0 anywhere in the I my Code (target framework 4.7.2) I get the error message below. I tried checking and unchecking the "Single + Double inf"- and "-nan(ind)" checkboxes in the DllExport GUI but it did not help. I can get it to compile by using your IL assembler but when doing this I loose the ability to debug my code (no breakpoints are working anymore). The same issue appears for +-Inf too. Can you please help me how to fix this? Thanks!

Information from Data tab or log data:

1>C:\test\packages\DllExport.1.7.3\tools\net.r_eg.DllExport.targets(76,5): error : C:\test\test_project\test.cs(123) : error : syntax error at token '-' in: IL_0029: ldc.r8 -nan(ind)

Demo Project files / Samples / etc.:

. . .


3F commented 3 years ago

@kcl93 Please follow the minimal information from the issue template:

  1. Attach information from Data tab
  2. DllExport [args if used] > cfg.log do not change anything, just Apply.
  3. Build project msbuild [your.sln] /t:Rebuild /m:4 /v:diag > build.log

Attach cfg.log and build.log

Thanks.

kcl93 commented 3 years ago

Hello @3F thanks for the quick reply. I have added the required files (including a whole small test project to trigger the issue) below:

Test.zip

Installed: True; 1.7.3+9a4bc51; invoked: 1.7.3
Project type: Cs
Storage: ProjectFiles
Compiler.Platform: Auto
Compiler.ordinalsBase: 1
Compiler.rSysObj: False
Compiler.ourILAsm: False
Compiler.customILAsm:
Compiler.genExpLib: False
Compiler.peCheck: PeIl
Compiler.patches: 3
PreProc.Type: None
PreProc.Cmd:
PostProc.Type: None
PostProc.ProcEnv: $(SolutionPath);$(MSBuildThisFileFullPath)
PostProc.Cmd:
SignAssembly:
Identifier: 21E8B94B-4558-4AEA-848D-9D6D56785116
Instance: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe
Project path: C:\Test\Test\Test.csproj
Action: Configure
PlatformTarget:
TargetFramework:
TargetFrameworks:
TargetFrameworkVersion: v4.7.2
RootNamespace: Test
AssemblyName: Test
MgrArgs:
MetaLib: tools\raw\lib\net20\DllExport.dll
MetaCor: tools\raw\lib\netstd\DllExport.dll
Proxy:
StoragePath: .net.dllexport.targets
ddNS: Test
ddNS max buffer: 500
UseCecil: True
intermediateFiles: False
timeout: 30000
RootPath: C:\Test\
PkgPath: C:\Test\packages\\DllExport.1.7.3\
SlnFile:
SlnDir: C:\Test\.\
DxpTarget: tools\net.r_eg.DllExport.targets
MsgGuiLevel: -1
LockIfError:
3F commented 3 years ago

Looks like a bug in processing scopes for Compiler.patches.

@kcl93 Thanks for the detailed information and project sample!

Temporarily either encapsulate problematic definitions inside some export methods OR try to use my IL assembler.

Unfortunately I still can't talk anything specific about fixes/releases at least from me due to my health problems and more; thus just follow the news. Thanks.

kcl93 commented 3 years ago

Hello @3F, thanks for the quick reply! Sadly I can not use your IL assembler as this prevents me from debugging my code (breakpoints do not trigger). However I will try your suggestion to use an exported function that creates NaN values or stay with my current workaround where I just use -666.6 instead of NaN as this will suit me fine to visually see invalid values. Don't hurry and get well soon! :) Thanks for this great piece of software! I do not know how I could create my programs without it!

3F commented 3 years ago

Don't hurry and get well soon! :) Thanks for this great piece of software! I do not know how I could create my programs without it!

@kcl93 🤝 Thank you! I hope for it 🖐

Sadly I can not use your IL assembler as this prevents me from debugging my code (breakpoints do not trigger).

This is because of disabled .line https://github.com/3F/coreclr/issues/3

I just use -666.6 instead of NaN as this will suit me fine to visually see invalid values.

Try like this:

double inf = 1e+280;
inf *= 1e+210;
inf *= 1e+110;

inf * 0.0F;

where 0.0F finally must align infinity to -nan(ind)

3F commented 3 years ago

Please test the fix before merge:

DllExport -force -pkg-link https://ci.appveyor.com/api/buildjobs/wmeu0q8ufdthsi4v/artifacts/bin/Release/DllExport.1.7.3.nupkg

kcl93 commented 3 years ago

Hello @3F I have tested your fix as requested and my project now compiles perfectly fine. Thank you very much! I hope, that you had some nice christmas celebration and are going to have a good start in a better year 2021 :)

3F commented 3 years ago

Thank you!

I crossed my fingers for a good next year 🤞🤞21

And thanks for using my projects, https://github.com/3F

-- Denis