Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@mderoy

Description

@mderoy

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions