Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
145737 stories
·
32 followers

Microsoft is raising prices on Xbox consoles in the US again

1 Share

Microsoft is raising the prices of its Xbox Series S / X consoles in the US next month. The Xbox Series X will be priced at $649.99 in the US starting October 3rd, up from its existing $599.99 price. The Xbox Series S will move to $399.99, up from $379.99.

Microsoft blames the price hikes on “changes in the macroeconomic environment,” which is a lot of words to say: tariffs. Xbox console pricing outside the US will remain the same. Thankfully, pricing for controllers and headsets will remain in the same in the US.

The price rises mean Xbox Series S consoles will increase by $20, Xbox Series X consoles by $50, and the 2TB Galaxy Black Special Edition Xbox Series X is increasing by $70 all the way up to $799.99.

Here’s the full list of price increases in the US:

ProductNew US price (RRP)Previous US price (RRP)
Xbox Series S (512GB)$399.99$379.99
Xbox Series S (1TB)$449.99$429.99
Xbox Series X$649.99$599.99
Xbox Series X Digital$599.99$549.99
Xbox Series X 2TB Galaxy Black Special Edition$799.99$729.99

Microsoft only just raised the prices of its Xbox products worldwide in May, with price hikes to the Xbox Series S / X consoles, controllers, and headsets. Those previous price increases already bumped the Xbox Series X by $100, and the Xbox Series S by $80. Coupled with today’s announcement, that means the Xbox Series X has increased in price in the US by $150 and the Series S by $100 in just six months.

Microsoft’s Xbox Series X 2TB Galaxy Black Special Edition originally debuted nearly a year ago at $599.99, and it’s now about to be $799.99 — a $200 increase in just a year. Microsoft’s latest price increases are the second this year, following initial price hikes in 2023.

Microsoft also planned to hike the price of some of its first-party Xbox games to $80 this holiday, but then walked back those changes in July.

Read the whole story
alvinashcraft
28 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Mihai Tataran on Testing and Evaluating Generative AI Solutions

1 Share

Episode 868

Mihai Tataran on Testing and Evaluating Generative AI Solutions

Generative AI projects present challenges when trying to test and evaluate nondeterministic output. He describes his approach to validating the quality of these systems and ways to improve them.

Read the whole story
alvinashcraft
29 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Learning to read C++ compiler errors: Not a legal base class

1 Share

A colleague was trying to create a Windows Runtime delegate with WRL. Here’s a simplified version of what they wrote.

namespace ABI
{
    using namespace ABI::Windows::UI::ViewManagement;
}

struct MyClass :
    Microsoft::WRL::RuntimeClass<⟦...⟧>
{
    HRESULT OnInputPaneShowing(ABI::InputPane* sender,
                               ABI::InputPaneVisibilityEventArgs* args);

    void RegisterShowing(ABI::InputPane* inputPane);

    EventRegistrationToken m_showingToken{};
};

When they tried to create the delegate,

void MyClass::RegisterShowing(ABI::InputPane* inputPane)
{
    m_showingToken = inputPane->put_Showing(
        Microsoft::WRL::Callback<ABI::ITypedEventHandler<
            ABI::InputPane*,
            ABI::InputPaneVisibilityEventArgs*>>(
            &MyClass::OnInputPaneShowing).Get());
}

they got a quite lengthy error message.

wrl\event.h(348,165): error C2516: 'Microsoft::WRL::Details::RemoveReference<TCallback>::Type': is not a legal base class
    with
    [
        TCallback=HRESULT (__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)
    ]
(compiling source file 'test.cpp')
wrl\internal.h(96,19):
see declaration of 'Microsoft::WRL::Details::RemoveReference<TCallback>::Type'
    with
    [
        TCallback=HRESULT (__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)
    ]
wrl\event.h(348,165):
the template instantiation context (the oldest one first) is
    test.cpp(134,30):
    see reference to function template instantiation 'Microsoft::WRL::ComPtr<TDelegateInterface> Microsoft::WRL::Callback<ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>,HRESULT(__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)>(TLambda &&) noexcept' being compiled
    with
    [
        TDelegateInterface=ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>,
        TLambda=HRESULT (__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)
    ]
    wrl\event.h(460,45):
    see reference to function template instantiation 'Microsoft::WRL::ComPtr<TDelegateInterface> Microsoft::WRL::Details::DelegateArgTraits<HRESULT (__cdecl ABI::Windows::Foundation::ITypedEventHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPane *>,ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *>>::* )(ABI::Windows::UI::ViewManagement::IInputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)>::Callback<ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>,ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>,Microsoft::WRL::NoCheck,T>(TLambda &&) noexcept' being compiled
    with
    [
        TDelegateInterface=ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>,
        T=HRESULT (__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *),
        TLambda=HRESULT (__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)
    ]
    wrl\event.h(367,9):
    while compiling class template member function 'Microsoft::WRL::ComPtr<TDelegateInterface>::ComPtr(Microsoft::WRL::ComPtr<U> &&,Details::EnableIf<Microsoft::WRL::Details::IsConvertible<U*,T*>::value,void*>::type *) noexcept'
    with
    [
        TDelegateInterface=ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>,
        T=ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>
    ]
    wrl\event.h(367,9):
    see reference to class template instantiation 'Microsoft::WRL::Details::IsConvertible<Microsoft::WRL::Details::DelegateArgTraits<HRESULT (__cdecl ABI::Windows::Foundation::ITypedEventHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPane *>,ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *>>::* )(ABI::Windows::UI::ViewManagement::IInputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)>::DelegateInvokeHelper<ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>,T,Microsoft::WRL::NoCheck,ABI::Windows::UI::ViewManagement::IInputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *> *,ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*> *>' being compiled
    with
    [
        T=HRESULT (__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)
    ]
    wrl\internal.h(67,35):
    see reference to class template instantiation 'Microsoft::WRL::Details::DelegateArgTraits<HRESULT (__cdecl ABI::Windows::Foundation::ITypedEventHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPane *>,ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *>>::* )(ABI::Windows::UI::ViewManagement::IInputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)>::DelegateInvokeHelper<ABI::Windows::Foundation::ITypedEventHandler<ABI::Windows::UI::ViewManagement::InputPane*,ABI::Windows::UI::ViewManagement::InputPaneVisibilityEventArgs*>,T,Microsoft::WRL::NoCheck,ABI::Windows::UI::ViewManagement::IInputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *>' being compiled
    with
    [
        T=HRESULT (__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)
    ]

As is typical of C++ error messages, the interesting things are at the start and the end.

For the Microsoft Visual C++ compiler, the error message starts with the point where the compiler noticed the error, and it ends with a description of what piece of the original source code triggered that error. Though in this case, the “original source code” got buried in the middle because the compiler chose to show the instantiations oldest first.

The compiler ran into a problem trying to create a derived class and realizing that the base class is invalid.

error C2516: 'Microsoft::WRL::Details::RemoveReference<TCallback>::Type': is not a legal base class
    with
    [
        TCallback=HRESULT (__cdecl MyClass::* )(ABI::Windows::UI::ViewManagement::InputPane *,ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *)
    ]

The TCallback is the type of the &MyClass::OnInputPaneShowing, and from the name, Remove­Reference<T> probably removes reference qualifiers. This is not reference-qualified, so it’s a nop, so the error message is saying

'decltype(&MyClass::Completed)': is not a legal base class

And that’s true. Pointers to member functions are not valid base classes.

If we look at the line in question:

template<typename TDelegateInterface, typename ...TArgs>
class DelegateArgTraits<
        HRESULT (STDMETHODCALLTYPE TDelegateInterface::*)(TArgs...)>
{
    template<typename TOtherDelegateInterface,
             typename TCallback,
             DelegateCheckMode checkMode,
             typename... TOtherArgs>
    struct DelegateInvokeHelper WrlFinal :
        public ::Microsoft::WRL::RuntimeClass<
            RuntimeClassFlags<Delegate>, TOtherDelegateInterface>,
        RemoveReference<TCallback>::Type
    {
        DelegateInvokeHelper(TCallback&& callback) throw() :
            RemoveReference<TCallback>::Type(
                Details::Forward<TCallback>(callback)) {}

        HRESULT STDMETHODCALLTYPE Invoke(TOtherArgs... args) throw() override
        {
            return DelegateTraits<checkMode>::CheckReturn(
                (*this)(Details::Forward<TOtherArgs>(args)...));
        }
    };

    ⟦...⟧
};

we see that the DelegateInvokeHelper removes references from TCallback and then derives from it. In our case, the TCallback was a pointer to a member function, and you can’t derive from that.

Even if we got past that problem, the next issue is that the Invoke method tries to use the function call operator operator() to invoke the TCallback. But you can’t invoke pointers to member functions that way. You have to use the function call syntax in conjunction with an explicit object: (obj.*callback)(args).

Okay, so we see from the point of failure that the TCallback parameter must satisfy two criteria.

  • Must be a class type that can be derived from.
  • Must have a function call operator that can be invoked with the delegate arguments.

It seems that the code wants to invoke the OnCompleted method on the this object, and we need to do that in the function call operator of a class type. Fortunately, C++ provides a handy syntax for this: A lambda.

void MyClass::RegisterShowing(ABI::InputPane* inputPane)
{
    m_showingToken = inputPane->put_Showing(
        Microsoft::WRL::Callback<ABI::ITypedEventHandler<
            ABI::InputPane*,
            ABI::InputPaneVisibilityEventArgs*>>(
            [this](auto&&... args) {               
                return OnInputPaneShowing(args...);
            }).Get());
}

(We can be lazy about how we forward the arguments because we know that the ABI parameters don’t have move constructors, so forwarding is the same as copying.)

Or if we look at the other overloads of WRL::Callback, we see a family of callbacks that do exactly what we want.

template<
   typename TDelegateInterface,
   typename TCallbackObject,
   typename... TArgs
>
ComPtr<TDelegateInterface> Callback(
   _In_ TCallbackObject *object,
   _In_ HRESULT (TCallbackObject::* method)(TArgs...)
);

Here is the implementation in the library:

template<typename TDelegateInterface,
         typename TCallbackObject,
         typename... TArgs>
ComPtr<typename Details::DelegateArgTraitsHelper<
                        TDelegateInterface>::Interface>
Callback(_In_ TCallbackObject *object,
         _In_ HRESULT(TCallbackObject::* method)(TArgs...)) throw()
{
    return Callback<TDelegateInterface>(
        [=](auto&& ...args)
        { return ((*object).*(method))(args ...); });
} 

The lambda is identical to the one we created manually, so we can just use

void MyClass::RegisterCompletion(ABI::IAsyncAction* action)
{
    m_showingToken = inputPane->put_Showing(
        Microsoft::WRL::Callback<ABI::ITypedEventHandler<
            ABI::InputPane*,
            ABI::InputPaneVisibilityEventArgs*>>(
            this, &MyClass::OnInputPaneShowing).Get());
}

The purpose of the discussion was not to diagnose this specific use of the WRL::Callback function but rather as an exercise in reading compiler error messages and reconciling the error text (that talks about what the compiler sees) with the original code in order to understand what the code was expecting, and why we failed to meet that expectation.

Final note: Since this is captured as a raw pointer, we have to ensure that the MyClass object is not destroyed if there is a chance that the event handler could be called (or is in the middle of a call). We get away with it here because the input pane raises its events on the UI thread, so we don’t have to worry about an event being in flight or on its way at the time we unregister it.

The post Learning to read C++ compiler errors: Not a legal base class appeared first on The Old New Thing.

Read the whole story
alvinashcraft
29 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

How Replit is Protecting You From the "Shai-Hulud" Worm

1 Share
Recently, a sophisticated supply chain attack compromised the popular @ctrl/tinycolor NPM package, which receives over 2 million weekly downloads, alongside hundreds of other packages in what has dubbed the "Shai-Hulud" attack. The attack's worm-like behavior and automated credential harvesting capabilities make it an extremely severe JavaScript supply chain attack, and the first worm of its kind affecting npm packages, exposing sensitive developer credentials across the industry. Unlike traditional malware that targets individual systems, this attack specifically compromises JavaScript packages that developers install in the projects. When the package is being installed, it executes the malicious npm postinstall lifecycle script bundle.js . The script scans the developer’s codebase for sensitive credentials like Github tokens and NPM authentication tokens. The token credentials are then used to inject the malware into more packages under the compromised developer’s account. It is creating a rapidly spreading infection across the NPM ecosystem. Since Replit controls the network environment where users’ development environments run, we were able to take immediate action to protect our users. To ensure Replit users don't have their credentials stolen, we blocked the exfiltration endpoint across all development environments. This measure prevents the compromised packages from transmitting harvested credentials to the attacker's webhook endpoint, neutralizing the threat. In addition to this, we've upgraded our Security Scanner to detect malicious code in our users' environments. It now includes a Malicious File Detection feature: it detects known malicious files from attacks, including the the files which indicate compromise from the Shai-Hulud worm.

Read the whole story
alvinashcraft
30 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

3 ways to use photo-to-video in Gemini

1 Share
Here’s how I’ve been using Gemini’s photo-to-video tool as a multimedia storyteller, plus some tips for making your own videos.
Read the whole story
alvinashcraft
1 hour ago
reply
Pennsylvania, USA
Share this story
Delete

Find out what’s new in the Gemini app in September’s Gemini Drop.

1 Share
Gemini Drops is our new monthly update on how to get the most out of the Gemini app.
Read the whole story
alvinashcraft
1 hour ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories