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

CounterType Enumeration and System.Diagnostics.PerformanceData namespace not implemented #7421

Open
mderoy opened this issue Mar 5, 2018 · 3 comments

Comments

@mderoy
Copy link
Contributor

mderoy commented Mar 5, 2018

https://msdn.microsoft.com/en-us/library/bb156214(v=vs.110).aspx not implemented

Steps to Reproduce

  1. Compile this code with visual studio
using System;
using System.Collections.Generic;
using System.Diagnostics.PerformanceData;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TypeloadRepro
{
    class Program
    {
        static void Main(string[] args)
        {
            CounterType f = CounterType.AverageCount64;
            Console.WriteLine(f);
        }
    }
}
  1. Run, notices the output
AverageCount64
  1. Try compiling with mono. This type should be in System.Core
C:\Users\UnityAdmin\source\repos\TypeloadRepro\TypeloadRepro>"C:\Program Files\Mono\bin\mcs" /reference:System.Core.dll Program.cs
Program.cs(3,26): error CS0234: The type or namespace name `PerformanceData' does not exist in the namespace `System.Diagnostics'. Are you missin
Compilation failed: 1 error(s), 0 warnings
  1. Try running what was compiled with visual studio and you get a TypeLoadException
Unhandled Exception:
System.TypeLoadException: Could not resolve type with token 01000011 (from typeref, class/assembly System.Diagnostics.PerformanceData.CounterType, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not resolve type with token 01000011 (from typeref, class/assembly System.Diagnostics.PerformanceData.CounterType, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)

Current Behavior

Mono will not compile this code, and libraries/executables built using this type throw TypeLoadException

Expected Behavior

Mono will compile this, and not raise TypeLoadExceptions when libraries/executables use this

On which platforms did you notice this

[ ] macOS
[ ] Linux
[ x] Windows

Version Used:

C:\Users\UnityAdmin\source\repos\EventProviderTraceListenerRepro\EventProviderTraceListenerRepro>"C:\Program Files\Mono\bin\mono.exe" --version
Mono JIT compiler version 5.10.0 (Visual Studio built mono)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           normal
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          supported, not enabled.
        GC:            sgen (concurrent by default)

Unity Issue Tracker - https://issuetracker.unity3d.com/issues/unity-fails-to-load-net-4-dot-6-assemblies-with-typeloadexception

@akoeplinger
Copy link
Member

would the enum be enough for you or do you need all the classes in System.Diagnostics.PerformanceData ?

@mderoy
Copy link
Contributor Author

mderoy commented Mar 6, 2018

Our user's project is getting a typeload exception on that enum, but I'd prefer we had the api surface of System.Diagnostics.PerformanceData available and throwing NotImplementedException than missing completely in the case users include other libraries built with .NETFW that may include these types.

@akoeplinger
Copy link
Member

Ok, feel free to send a PR which adds these stubs :)

@akoeplinger akoeplinger added this to the Future milestone Mar 6, 2018
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

2 participants