Web
Web

Reputation: 19

Error CS0234: The type or namespace name 'CustomMarshalers' does not exist in the namespace 'System.Runtime.InteropServices'

using System;    
using System.Collections; 
using System.Reflection; 
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.CustomMarshalers;

namespace mshtml
{
    [DefaultMember("item"), CompilerGenerated, Guid("3050F21F-98B5-11CF-BB82-00AA00BDCE0B"), TypeIdentifier]
    [ComImport]
    public interface IHTMLElementCollection : IEnumerable
    {
        void _VtblGap1_3();
        [DispId(-4)]
        [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(EnumeratorToEnumVariantMarshaler))]
        IEnumerator GetEnumerator();
    }
}

The above code gives me the following error:

Error CS0234: The type or namespace name 'CustomMarshalers' does not exist in the namespace 'System.Runtime.InteropServices' (are you missing an assembly reference?)

Pleae advise how to fix? It's a decompiled code, and I am very beginner in C#.

Upvotes: 1

Views: 4488

Answers (2)

ErichO
ErichO

Reputation: 81

Sorry for resurrecting an old thread. With Framework 4.72, you can use Project -> Add Reference -> Assemblies -> Check the box next to CustomMarshalers.

Upvotes: 2

Michael
Michael

Reputation: 659

You have to include CustomMarshalers.dll
Example:
Add the reference using Project -> Add Reference -> Browse -> Go to location "C:\Windows\assembly\GAC_32\CustomMarshalers\2.0.0.0__b03f5f7f11d50a3a" -> Select CustomMarshalers.dll

Upvotes: 3

Related Questions