ICE in explicit override of interface property getter

B

Ben Voigt

Getting a C1001 internal error off the following code:

I've found an alternate means of making the Node property accessible in the
parent class only using a public interface, private implementation class,
and static_cast to downcast, but now I'm stuck wondering how to prevent any
other class from being derived from that interface!

Still thought I'd post this ICE to see if anyone else can validate it.

ref class PrioritizedWorkScheduler
{
public:
ref class ScheduledTask;

private:
interface class ITask
{
property System::Collections::Generic::LinkedListNode<ScheduledTask^>^
Node
{
System::Collections::Generic::LinkedListNode<ScheduledTask^>^ get();
}
};

public:
ref class ScheduledTask sealed : ITask
{
initonly System::Collections::Generic::LinkedListNode<ScheduledTask^>^
me;

property System::Collections::Generic::LinkedListNode<ScheduledTask^>^
Node
{
virtual System::Collections::Generic::LinkedListNode<ScheduledTask^>^
get() sealed = ITask::Node::get
{
return me;
}
}

public:
ScheduledTask()
{
me = gcnew
System::Collections::Generic::LinkedListNode<ScheduledTask^>(this);
}
};
};
 
G

Gary Chang[MSFT]

Hi Ben,

I have already repro this problem in our local machine and forward it to
our product team for review. I will update when I get the result.

Thanks for reporting this issue to us and I suggest you can also submit it
in our feedback center, our development team may communicate with you
directly on
the issue there:

http://connect.microsoft.com/feedback/default.aspx?SiteID=210

Have a nice weekend!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
B

Ben Voigt

"Gary Chang[MSFT]" said:
Hi Ben,

I have already repro this problem in our local machine and forward it to
our product team for review. I will update when I get the result.

Thanks for reporting this issue to us and I suggest you can also submit it
in our feedback center, our development team may communicate with you
directly on
the issue there:

http://connect.microsoft.com/feedback/default.aspx?SiteID=210

Please validate:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=239629
 
G

Gary Chang[MSFT]

Hi Ben,

I also got the confiormation from the corresponding product team-- this is
a compiler bug, even in current builds. There isn't much workaround that
we can find without changing the hierarchy of the interface and class.

Do you need the interface ITask and ScheduledTask being nested in
PrioritizedWorkScheduler?

If you wants ITask to be only visible to ScheduledTask, we suggest you
could make ITask a private in an assembly and ScheduledTask be a public
explicit implementation in that same assembly.

By the way, thanks for submit that bug report in our feedback center, our
product team engineer would take care of it.

Thanks!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
B

Ben Voigt

"Gary Chang[MSFT]" said:
Hi Ben,

I also got the confiormation from the corresponding product team-- this is
a compiler bug, even in current builds. There isn't much workaround that
we can find without changing the hierarchy of the interface and class.

Do you need the interface ITask and ScheduledTask being nested in
PrioritizedWorkScheduler?

If you wants ITask to be only visible to ScheduledTask, we suggest you
could make ITask a private in an assembly and ScheduledTask be a public
explicit implementation in that same assembly.

The idea was that ITask members would be only visible to
PrioritizedWorkScheduler, and an opaque handle to the clients... so I did
the C opaque handle thing (I've also taken the class native -- mixing
managed and native code is just awesome, and I can use pragma unmanaged to
guarantee certain functions can't be interrupted by garbage collection):

class PrioritizedWorkScheduler

{

public:

struct ScheduledTaskImpl;

typedef ScheduledTaskImpl* ScheduledTask;

typedef std::list<ScheduledTask> TaskList;

typedef TaskList::iterator TaskNode;

};



Downside is that now there can be no publicly available members in
ScheduledTaskImpl. But if I need that, I can make a public interface, and
change ScheduledTask from a raw pointer typedef to a pointer wrapper class
with operator->() cast to the interface.

By the way, thanks for submit that bug report in our feedback center, our
product team engineer would take care of it.

I think C# forbids what I was trying to do, it would generate an error
message "base class is less visible than derived class"... not sure if I've
seen that error generated for an interface or only base classes though.
 
G

Gary Chang[MSFT]

Thanks for the response, Ben.

By the way, I suggest you monitor the issue you submit in the feedback
center, our product team engineer also would follow up there.

Good Luck!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top